Re: [Tutor] py2exe

2005-07-08 Thread Reed L. O'Brien
D. Hartley wrote: >Hello everyone, and I apologize in advance if anyone gets this message twice. > >I am trying to figure out how to use py2exe. I've created a game and >sent it to friends before, and had to have them install python, >pygame, and livewires in order to play it, which, as you can im

Re: [Tutor] dictionary values

2005-07-08 Thread Brian van den Broek
Kent Johnson said unto the world upon 08/07/2005 21:09: > Brian van den Broek wrote: > >>if you care about the possibility that there is no unique key with the >>lowest value, I'd do: >> >> >>> def get_low_keys(a_dict): >>... '''-> list of keys in a_dict with lowest value''' >>... min_val = m

Re: [Tutor] dictionary values

2005-07-08 Thread Kent Johnson
Brian van den Broek wrote: > if you care about the possibility that there is no unique key with the > lowest value, I'd do: > > >>> def get_low_keys(a_dict): > ... '''-> list of keys in a_dict with lowest value''' > ... min_val = min(a_dict.values()) > ... low_keys = [] > ... for k,v in

Re: [Tutor] dictionary values

2005-07-08 Thread Kent Johnson
luke p wrote: > just assume all the below code is correct. > I am not having a problem with it, it is all for example only. > > I have a dictionary like this: > alpha = {'a':0,'b':0, ... 'z':0} > and the following code > f = file("hamlet.txt","r") > text = f.readlines() > f.close() > for line in t

Re: [Tutor] dictionary values

2005-07-08 Thread Brian van den Broek
luke p said unto the world upon 08/07/2005 19:40: > just assume all the below code is correct. > I am not having a problem with it, it is all for example only. > > I have a dictionary like this: > alpha = {'a':0,'b':0, ... 'z':0} > and the following code > f = file("hamlet.txt","r") > text = f.rea

Re: [Tutor] dictionary values

2005-07-08 Thread Brian van den Broek
Don Parris said unto the world upon 08/07/2005 20:09: > On 7/8/05, luke p <[EMAIL PROTECTED]> wrote: >>what I want to do is find out which value in my dictionary is lowest. >>is there a dictionary function for this, like alpha.min() that will >>return a key:value pair of the lowest? I cannot fi

[Tutor] py2exe

2005-07-08 Thread D. Hartley
Hello everyone, and I apologize in advance if anyone gets this message twice. I am trying to figure out how to use py2exe. I've created a game and sent it to friends before, and had to have them install python, pygame, and livewires in order to play it, which, as you can imagine, is a royal pain.

Re: [Tutor] dictionary values

2005-07-08 Thread Don Parris
On 7/8/05, luke p <[EMAIL PROTECTED]> wrote: > just assume all the below code is correct. > I am not having a problem with it, it is all for example only. > > I have a dictionary like this: > alpha = {'a':0,'b':0, ... 'z':0} > and the following code > f = file("hamlet.txt","r") > text = f.readline

[Tutor] dictionary values

2005-07-08 Thread luke p
just assume all the below code is correct. I am not having a problem with it, it is all for example only. I have a dictionary like this: alpha = {'a':0,'b':0, ... 'z':0} and the following code f = file("hamlet.txt","r") text = f.readlines() f.close() for line in text: for char in line: try:

Re: [Tutor] Why does invalid syntax pop up? (fwd)

2005-07-08 Thread Brian van den Broek
Danny Yoo said unto the world upon 08/07/2005 18:14: > [Nathan, please don't send only to me: make sure you're using "Reply to > All" and that tutor@python.org is also being replied to. I'm actually > going slightly crazy with work right now, but there are other people on > the mailing list who ca

Re: [Tutor] Dict operation question.

2005-07-08 Thread Javier Ruere
Kent Johnson wrote: > My understanding of the OP is that he wants an exception if there are items > in errdict. Also this solution will change self.somedict even in the error > case which may not be desirable. I understood what the OP said but think he expressed himself incorrectly or the alg

Re: [Tutor] Dict operation question.

2005-07-08 Thread David Driver
Really I was just wondering if this was a bad practice or if there was some way to get the same result. So if the list comprehension isn't a bad way to to it then I will stick with it. I am at the point where I have used python for simple stuff for a few years and I am attempting to get past a n

Re: [Tutor] Why does invalid syntax pop up? (fwd)

2005-07-08 Thread Danny Yoo
[Nathan, please don't send only to me: make sure you're using "Reply to All" and that tutor@python.org is also being replied to. I'm actually going slightly crazy with work right now, but there are other people on the mailing list who can help. I'm forwarding your message to the rest of the mail

Re: [Tutor] Why does invalid syntax pop up?

2005-07-08 Thread Brian van den Broek
Nathan Pinno said unto the world upon 08/07/2005 16:14: > Thanks, Danny and all. > > Adjusted the code, here is the newest code and error: > def add_login_command(site,filename): > print "Add a login info card" > site = raw_input("Site: ") > id = raw_input("User ID: ")

Re: [Tutor] Why does invalid syntax pop up?

2005-07-08 Thread Danny Yoo
> Error Message: > Traceback (most recent call last): > File "D:\password.py", line 73, in ? > add_login_command() > TypeError: add_login_command() takes exactly 2 arguments (0 given) > > How do I fix it so that it runs properly, and any other errors that have > to be fixed?

Re: [Tutor] Why does invalid syntax pop up?

2005-07-08 Thread Nathan Pinno
Thanks, Danny and all. Adjusted the code, here is the newest code and error: # This is the code for a password protected program to store passwords. password = "hello" print "The Password Program" print "Copyright 2005 Nathan Pinno." print answer = raw_input("What is the password?

Re: [Tutor] New entry in the Tutor list - Question: Python and dbf files

2005-07-08 Thread Terry Carroll
On Fri, 8 Jul 2005, Alessandro Brollo wrote: > 1. Does a Python dbf reader/writer module exist > somewhere? A google on "python dbf" led me to a few promising leads: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362715 http://www.fiby.at/dbfpy/ http://www.garshol.priv.no/download/so

Re: [Tutor] maximum recursion depth exceeded !

2005-07-08 Thread Alan G
>> Ooh, that's nice. When did the ability to tweak it programmatically >> appear? Or has it always been there and I've just never noticed? > > It isn't in the 1.5.2 documentation but in the 2.0 documentation, so > it has been there for some time ;-) I did most of my deep digging in Python on 1.5.

[Tutor] __init__.py not working?

2005-07-08 Thread Bernard Lebel
Hello, In my script library, one directory is named "rendering". When I try to import a module from this directory, I always get this error: #ImportError: dynamic module does not define init function (initrendering) However, there is an __init__.py file in there, and also the pyc version. All ot

[Tutor] New entry in the Tutor list - Question: Python and dbf files

2005-07-08 Thread Alessandro Brollo
I'm using Python 2.3 in Win32/WinXP context. I'm new at all to newsgroups and discussion lists; the first help I need, is how to learn "good-manner" use of such very effective, but time-consuming tools. My approach will be a "try-and-error" one; I encourage all of you to send me any suggestion/obs

Re: [Tutor] Dict operation question.

2005-07-08 Thread Kent Johnson
Javier Ruere wrote: > I should also add the most simple and obvious implementation which is also > the fastest: > > > class Test: > def __init__(self, dict): > self.somedict = dict > > def updateit(self, **mydict): > errdict = {} > for k, v in mydict.iteritems():

Re: [Tutor] Dict operation question.

2005-07-08 Thread Kent Johnson
David Driver wrote: > I have a function > > def updateit(self,**mydict): > > which is intended to update a dictionary self.somedict. > > If there are keys in mydict that are not in self.somedict I want them > returned in a new dict. > > here is what i am doing now: > > errdict = dict([(a,b) f