Data structure is a dictionary, each value is another dictionary, like:
>>> from lib import schedule
>>> schedule = schedule.Schedule()
>>> game = schedule.games[0]
>>> game.home
<lib.schedule.Team instance at 0x9d97c6c>
>>> game.home.lineup
{'guerv001': {'HR': 392, '1B': 1297}, 'kendh001': {'HR': 12, '1B': 201}, 'andeg001': {'HR': 272,...
Hi,
I'm trying to build a DNS server in python. It must listen two ports (8007 - client, 8008 - admin). The client only send an URL and receives the respective IP. The admin has permissions to change the DNS table (add, remove,.. doesn't matter to this right now).
So my question is: how do I implement the server listening continuously ...
I didn't know you could do this:
def tom():
print "tom's locals: ", locals()
def dick(z):
print "z.__name__ = ", z.__name__
z.guest = "Harry"
print "z.guest = ", z.guest
print "dick's locals: ", locals()
tom() #>>> tom's locals: {}
#print tom.guest #AttributeError: 'function' object has no attribut...
I have a data set which is a large unweighted cyclic graph The cycles occur in loops of about 5-6 paths. It consists of about 8000 nodes and each node has from 1-6 (usually about 4-5) connections. I'm doing single pair shortest path calculations and have implemented the following code to do a breadth-first search.
from Queue import Queu...
How can I take the opt result of
opt, args = parser.parse_args()
and place it in a dict? Python calls opt a "Values Instance" and I can't find any way to turn a Values Instance into a list or dict. One can't copy items from opt in this way,
for i in opt:
myDict[i] = opt[i]
instead, its a clumsy,
myDict[parm1] = opt.parm1
myDic...
I am having trouble getting the bulk uploader to work. I have been
following the tutorial here:http://code.google.com/appengine/docs/
python/tools/uploadingdata.html.
When I enter the following command (from Windows, using PowerShell)
appcfg.py upload_data --config_file=src/friend_loader.py --filename=frienddata.csv --kind=Friend ./sr...
I'm about to embark on some large Python-based App Engine projects, and I think I should check with Stack Overflow's "wisdom of crowds" before committing to a unit-testing strategy. I have an existing unit-testing framework (based on unittest with custom runners and extensions) that I want to use, so anything "heavy-weight"/"intrusive" ...
Hi Everybody,
I am developing a project for one customer, where the design has a radio button with exclusive options.
Here is a piece of the code that runs and show two nice radio buttons:
self.performGroupBox = QtGui.QGroupBox(self.centralwidget)
self.performGroupBox.setGeometry(QtCore.QRect(50, 20, 181, 121))
self.perfo...
Possible Duplicate:
Where can I find useful documentation for pyusb (Python USB library)?
i using PyUsb 0.4 on windows, but i can't find any tutorial ,anyone hav some link/resource
...
Hi
I have GUI that will interact with a postgres database, using psycopg2. I have db connection in a multiprocessing process, and send SQL via a multiprocessing queue, and receive via another queue.
The problem is that the speed is very very slow. A simple select * from a small table (30 rows) can be 1/10th of a second, or can take o...
Hello,
these day im making python script related with DOM.
problem is these day many website structure is very complicate .
what is best method to check DOM structure and path..
i mean...following is some example.
what is best method to check can extract such like following info quickly?
before i was spent much time to extract such...
A User will specify a time interval of n secs/mins/hours and then two times (start / stop).
I need to be able to take this interval, and then step through the start and stop times, in order to get a list of these times. Then after this, I will perform a database look up via a table.objects.filter, in order to retrieve the data correspon...
How could I, if possible, get information on what files have been added, removed, updated etc when running svn update in pysvn? I want to write this information to a log file.
...
I need to compile ICU using it's own build mechanism. Therefore the question:
How can I run a Makefile from setup.py? Obviously, I only want it to run during the build process, not while installing.
...
I installed feedparser via SSH, using
$ python setup.py install --home=~/httpdocs/python-libraries/feedparser-4.1/
I did that because I don't seem to have permission to properly run 'python setup.py install'
I am running the following python code in 'test.py'.
print "Content-type: text/html\n\n"
try:
import feedparser
except:
...
Hi
I have the following python code...
import Tkinter
root = Tkinter.Tk()
root.tk.eval('puts {printed by tcl}')
It prints "printed by tcl" to the screen. How can I capture what the tcl interpreter prints to the screen into a python string.
This is a simplified example of what I am doing. I have an automation system written in pyt...
I have done a simple program in PHP, now need to convert this into Python:
$string="Google 1600 Amphitheatre Parkway Mountain View, CA 94043 phone";
preg_match_all('/[0-9]+.{10,25}[^0-9]*[0-9]{5,6}+\s/',$string,$matches);
print_r($matches);
...
When I run the following code:
query = datastore.Food_Item.all()
results = query.fetch(1)
foodA = results[0]
foodB = db.get(foodA.key())
I would expect foodA and foodB to be the same type. However, I see that the foodA is of type "model.datastore.Food_Item" and foodB is of type "datastore.Food_Item". Why are they diffe...
Reading the Python cookbook at the minute and currently looking at generators. I'm finding it hard to get my head round.
As I come from a Java background, is there a Java equivelant? The book was speaking about 'Producer / Consumer', however when I hear that I think of threading.
Can anyone explain what a generator is and why you would...
I'm currently making system call to "unrar and zip" commands. It interrupts and requires me to enter password while encounter password propected archives.
Is it possible to let it run and return a "unsuccessful" value to main program on any error or password prompt?
Can we natively use rarfile and zipfile library to do the job without ...