[FAQTS] Python Knowledge Base Update -- July 30th, 2000
Fiona Czuczman
fiona at sitegnome.com
Sun Jul 30 00:35:44 EDT 2000
More information about the Python-list mailing list
Sun Jul 30 00:35:44 EDT 2000
- Previous message (by thread): Newbie question regarding .readline()
- Next message (by thread): not stopping til it works
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello Guys, The latest entries to http://python.faqts.com cheers, Fiona ## New Entries ################################################# ------------------------------------------------------------- What is the difference between 'import Tkinter' and 'from Tkinter import *'? http://www.faqts.com/knowledge-base/view.phtml/aid/5096 ------------------------------------------------------------- Fiona Czuczman richard_chamberlain If you use the from <something> import <something or *> it imports the contents into the current namespace. For instance if you use: from Tkinter import * you can use Label or Button directly, However, if you use import Tkinter you would have to use Tkinter.Label or Tkinter.Button. It is considered fairly poor practice to use from * import because you're bringing everything into the current namespace. One of the exceptions to this is GUI programming (i.e. Tkinter or whatever) because the names used are fairly obviously GUI related (Button,Widget,Canvas,etc.) ------------------------------------------------------------- Does anyone know how to read the PCI configuration space with Python under Win 98 or Linux? http://www.faqts.com/knowledge-base/view.phtml/aid/5097 ------------------------------------------------------------- Fiona Czuczman Shae Erisson, Erno Kuusela, Moshe Zadka, Tim Roberts Under linux you have 3 options: * use the lspci program. try lspci -x or lspci -vvv * read the files under /proc/bus/pci/ (this is actually what the lspci program does, but using lspci might save you from future format changes in these files...) * read /proc/pci do this if you are using an older version of linux (2.0.x) cat /proc/pci Or, in Python, open("/proc/pci").read() Doing this under Windows requires a C extension, and even then it isn't easy. Under Windows 98, you can scan the BIOS for the PCI entry point and call it directly. Under Windows NT, even this doesn't work; you need the help of a kernel driver. Much of the interesting PCI information is buried in the registry, which IS accessible from Python.
- Previous message (by thread): Newbie question regarding .readline()
- Next message (by thread): not stopping til it works
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list