[Tutor] Multi-Dimensional Dictionary that contains a 12 element list.

2005-12-28 Thread Paul Kraus
the units sold based on period. dictionary[(year,period)] = [ jan, feb, mar, apr, may, jun, july, aug, sep, oct, nov ,dec] I would prefer to have the months just be an array index 0 through 11 and when it reads the file it increments the number contained there. TIA, -- Paul Kraus =-=-=-=-=-=-=-=-=

Re: [Tutor] Multi-Dimensional Dictionary that contains a 12 element list.

2005-12-28 Thread Paul Kraus
On Wednesday 28 December 2005 10:18 am, Paul Kraus wrote: > I am trying to build a data structure that would be a dictionary of a > dictionary of a list. > > In Perl I would build the structure like so $dictionary{key1}{key2}[0] = X > I would iterate like so ... > foreach my

[Tutor] Multiple Assignment from list.

2005-12-28 Thread Paul Kraus
How do I code this in python. Assuming fields is a list of 3 things. (myfielda, myfieldb, myfieldc) = fields When i try that I get ValueError: need more than 1 value to unpack. If i print fields it is in need printed as ['somestring','somestring','somestri

Re: [Tutor] Multiple Assignment from list.

2005-12-28 Thread Paul Kraus
Never mind. i figured this out. the top line of a file i was reading in and splitting only had 1 char so "fields" on that line was not a list. I fixed this. On Wednesday 28 December 2005 3:12 pm, Paul Kraus wrote: > How do I code this in python. Assuming fields is a lis

Re: [Tutor] Multi-Dimensional Dictionary that contains a 12 element list.

2005-12-29 Thread Paul Kraus
[key1][0] How would I increment it or assign it if it didn't exist. I assumed like this. dict[key1][0] = dictionary.get(key1[0],0) + X -- Paul Kraus =-=-=-=-=-=-=-=-=-=-= PEL Supply Company Network Administrator 216.267.5775 Voice 216.267.6176 Fa

Re: [Tutor] Multi-Dimensional Dictionary that contains a 12 element list.

2005-12-30 Thread Paul Kraus
> That is the approach Paul took originally (see the other fork of this > thread). He is accumulating a sparse 3d matrix where the keys are year, > field6 and month. (He hasn't said what field6 represents.) The problem > is that he wants to print out counts corresponding to all the existing > year

Re: [Tutor] Open file error

2006-01-17 Thread Paul Kraus
On Tuesday 17 January 2006 12:11 pm, andy senoaji wrote: > I am starting to pull my hair here. There were some postings in the past, > similar to my problem, but the response was not clear enough. Sorry if you > thingk I am reposting this. > > I am trying to run (on an XP box) a simple open file us

Re: [Tutor] Controling my loops and redundant code?!?

2006-01-26 Thread Paul Kraus
arated getting input from converting it to > integer so we can see if the user's entry is convertible.: > > available_points = MAX_POINTS - sum(points) > print "You have " + available_points + " available." > for x in range(len(attributes)): > cvalue =

[Tutor] Documentation

2006-02-05 Thread Paul Kraus
t are all the different things can I do with a button besides just setting the command and the text and such. These are just examples. I can't find an easy way to do this. I know there has to be i have tried the pydoc gui but I found nothing when i searched list. *shrug* --

Re: [Tutor] Documentation

2006-02-05 Thread Paul Kraus
ld I 'call the method keys'. from the example above. -- Paul Kraus =-=-=-=-=-=-=-=-=-=-= PEL Supply Company Network Administrator 216.267.5775 Voice 216.267.6176 Fax www.pelsupply.com =-=-=-=-=-=-=-=-=-=-= ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] GUI Development - Which toolkit

2006-02-06 Thread Paul Kraus
I am developing applications that need to run without work on both windows and linux and was wondering what gui toolkits everyone uses and why. I have been looking at wxpython and tkinter. Thanks in advance, -- Paul Kraus =-=-=-=-=-=-=-=-=-=-= PEL Supply Company Network Administrator

[Tutor] IDE - Editors - Python

2006-02-06 Thread Paul Kraus
TIA, -- Paul Kraus =-=-=-=-=-=-=-=-=-=-= PEL Supply Company Network Administrator 216.267.5775 Voice 216.267.6176 Fax www.pelsupply.com =-=-=-=-=-=-=-=-=-=-= ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] First Gui App - Please scrutinize

2006-02-06 Thread Paul Kraus
This is my first gui application. It just takes a percentage and then based on some options calculates a new price. --- #!/usr/bin/python from Tkinter import * class Application( Frame ): """ Price Calc GUI """ def __init__( self, master): Frame.__

[Tutor] Python - Embedded mysql server

2006-02-07 Thread Paul Kraus
Anyone know where I can find information about how to embedd mysql into a python application. I need my hand held. I have worked with mysql a lot. I understand how to use python to manipulate a mysql database. What I want to know is how to embedded a database into my application. -- Paul

[Tutor] Build Python 2.4 SCO OpenServer 5

2006-02-14 Thread Paul Kraus
m486 -DSCO5' ./python -E ./setup.py build;; \ esac /bin/sh: 9056 Memory fault - core dumped make: *** [sharedmods] Error 139 -- Paul Kraus =-=-=-=-=-=-=-=-=-=-= PEL Supply Company Network Administrator 216.267.5775 Voice 216.267.6176 Fax www.pelsupply.com =-=-=-=-=-=-=-=-=-=-=

[Tutor] unpack/regexp

2006-04-11 Thread Paul Kraus
$line =~ m/^(.{10})(.{10})(.{13}) ) -- Paul Kraus =-=-=-=-=-=-=-=-=-=-= PEL Supply Company Network Administrator 216.267.5775 Voice 216.267.6176 Fax www.pelsupply.com =-=-=-=-=-=-=-=-=-=-= ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] unpack/regexp

2006-04-11 Thread Paul Kraus
> Python regex is a bit more verbose than Perl but you can do the same thing: > > In [2]: import re > > In [11]: m=re.match("(.{10})(.{10})(.{13})", line) > > In [13]: m.group(1, 2, 3) > Out[13]: ('1234567890', '1234567890', '123456789012 ') That work great. Regex tend to be "expensive" is there a