[Tutor] Can't find error :-(

2011-08-28 Thread Lisi
Here is the error message: /usr/local/bin/AddressBook: line 6: syntax error near unexpected token `(' /usr/local/bin/AddressBook: line 6: `name = raw_input("Type the Name - leave blank to finish")' (sorry KMail wrapped it.) Here is what I typed: name = raw_input("Type the Name - leave blank to f

Re: [Tutor] Can't find error :-(

2011-08-28 Thread James Thornton
If you copied and pasted the line, it's possible the quote marks are of the wrong encoding -- try deleting the quote marks and adding them back. On Sun, Aug 28, 2011 at 6:34 AM, Lisi wrote: > Here is the error message: > /usr/local/bin/AddressBook: line 6: syntax error near unexpected token `(' >

Re: [Tutor] Can't find error :-(

2011-08-28 Thread Peter Otten
Lisi wrote: > Here is the error message: > /usr/local/bin/AddressBook: line 6: syntax error near unexpected token `(' > /usr/local/bin/AddressBook: line 6: `name = raw_input("Type the Name - > leave blank to finish")' > > (sorry KMail wrapped it.) > > Here is what I typed: > name = raw_input("Ty

Re: [Tutor] Can't find error :-(

2011-08-28 Thread R. Alan Monroe
> /usr/local/bin/AddressBook: line 6: syntax error near unexpected token `(' > /usr/local/bin/AddressBook: line 6: `name = raw_input("Type the Name - leave > blank to finish")' Were you accidentally trying a python 3 tutorial when your machine only has python 2 installed (or vice versa)? Alan

Re: [Tutor] Can't find error :-(

2011-08-28 Thread Lisi
On Sunday 28 August 2011 13:01:38 Peter Otten wrote: > Lisi wrote: > > Here is the error message: > > /usr/local/bin/AddressBook: line 6: syntax error near unexpected token > > `(' /usr/local/bin/AddressBook: line 6: `name = raw_input("Type the Name > > - leave blank to finish")' > > > > (sorry KMa

[Tutor] Still stuck - but a bit further on.

2011-08-28 Thread Lisi
Sorry, everybody. I am still having problems with this script - tho' it now runs correctly nearly to the end! Here is the whole script: #! /usr/bin/python # create an empty address book dictionary AddressBook = {} # read entries till an empty string print name = raw_input("Type the Name - lea

Re: [Tutor] Can't find error :-(

2011-08-28 Thread Steven D'Aprano
Lisi wrote: For future reference, how would I set about changing the encoding for just one character or file? I don't really want to change the encoding I use system wide. You can set the encoding for the entire source file with an encoding line like: # -*- coding: utf-8 -*- This MUST be

Re: [Tutor] Still stuck - but a bit further on.

2011-08-28 Thread Steven D'Aprano
Lisi wrote: [...] Type the Name - leave blank to finishLisi You have no space in the name. It is "Lisi". Type the Street, Town, Phone. Leave blank to finishth, rc, 123457 Type the Name - leave blank to finish Which name to display?(blank to finish) Lisi Here you have a space at the start

Re: [Tutor] Can't find error :-(

2011-08-28 Thread Alan Gauld
On 28/08/11 13:34, Lisi wrote: On Sunday 28 August 2011 13:01:38 Peter Otten wrote: Lisi wrote: Here is the error message: /usr/local/bin/AddressBook: line 6: syntax error near unexpected token That's an error message by your shell. You made your script executable, but forgot to add somethin

Re: [Tutor] Still stuck - but a bit further on.

2011-08-28 Thread Alan Gauld
On 28/08/11 14:53, Lisi wrote: Type the Name - leave blank to finishLisi Notice no space before Lisi Type the Street, Town, Phone. Leave blank to finishth, rc, 123457 Type the Name - leave blank to finish Which name to display?(blank to finish) Lisi Notice the space before Lisi? Traceba

Re: [Tutor] Still stuck - but a bit further on.

2011-08-28 Thread Lisi
On Sunday 28 August 2011 16:20:45 Alan Gauld wrote: > > Notice the space at the start of the string? > The stored entry is keyed on "Lisi" the search was for " Lisi" > which doesn't exist. I thought that I had tried that, but I obviously hadn't. I clearly needed that break! Thanks, Alan and Ste

[Tutor] Sorting list of tuples in two passes

2011-08-28 Thread Dayo Adewunmi
Hi I have a list of tuples that each have four elements: [(firstName,lastName,userName,gidNumber),(.)] I'm trying to sort this list in two passes. First by gidNumber and then the subgroups by lastName. So far i've only been able to sort by gidNumber. But I can't seem to wrap my mind a

[Tutor] need help to learn threading

2011-08-28 Thread Payal
Hi all, Can someone suggest a resource for me to learn threading in python? I don't know threading in any other language. I tried a few online tutorials but got lost soon. How do I start? With warm regards, -Payal -- ___ Tutor maillist - Tutor@pytho

Re: [Tutor] need help to learn threading

2011-08-28 Thread Nitin Pawar
this one at tutorial point explains multi threading with examples .. http://www.tutorialspoint.com/python/python_multithreading.htm On Sun, Aug 28, 2011 at 9:50 PM, Payal wrote: > Hi all, > Can someone suggest a resource for me to learn threading in python? I > don't know threading in any other

Re: [Tutor] Sorting list of tuples in two passes

2011-08-28 Thread Hugo Arts
On Sun, Aug 28, 2011 at 6:43 PM, Dayo Adewunmi wrote: > Hi > > I have a list of tuples that each have four elements: > > [(firstName,lastName,userName,gidNumber),(.)] > > I'm trying to sort this list in two passes. First by gidNumber and then the > subgroups by lastName. So far i've only b

Re: [Tutor] Sorting list of tuples in two passes

2011-08-28 Thread Dayo Adewunmi
On 08/28/2011 06:23 PM, Hugo Arts wrote: On Sun, Aug 28, 2011 at 6:43 PM, Dayo Adewunmi wrote: Hi I have a list of tuples that each have four elements: [(firstName,lastName,userName,gidNumber),(.)] I'm trying to sort this list in two passes. First by gidNumber and then the subgroups

Re: [Tutor] Sorting list of tuples in two passes

2011-08-28 Thread Steven D'Aprano
Dayo Adewunmi wrote: It works when I use your example, but I don't understand why it won't work when I use 4-element tuples instead of 2: What makes you say it doesn't work? It looks like it works to me: >>>l = [('wascas','aaa','fdvdfv', 1), ('rtgdsf','bbb','trfg', 1), ('addwe','ccc','esd',

Re: [Tutor] Sorting list of tuples in two passes

2011-08-28 Thread Hugo Arts
On Mon, Aug 29, 2011 at 2:19 AM, Dayo Adewunmi wrote: > On 08/28/2011 06:23 PM, Hugo Arts wrote: >> >> On Sun, Aug 28, 2011 at 6:43 PM, Dayo Adewunmi >>  wrote: >>> >>> Hi >>> >>> I have a list of tuples that each have four elements: >>> >>> [(firstName,lastName,userName,gidNumber),(.)] >>

[Tutor] Better way to compare values?

2011-08-28 Thread memilanuk
Hello, Recently picked back up the Python bug, and have started chipping away at the warm-up exercises over @ codingbat.com. I'm getting thru the basic stuff okay, but I'm getting a feeling that maybe I'm not doing things the 'right' way, even though the results are correct. Specifically,

Re: [Tutor] Better way to compare values?

2011-08-28 Thread bob gailer
On 8/28/2011 9:19 PM, memilanuk wrote: Hello, Recently picked back up the Python bug, and have started chipping away at the warm-up exercises over @ codingbat.com. I'm getting thru the basic stuff okay, but I'm getting a feeling that maybe I'm not doing things the 'right' way, even though th

Re: [Tutor] Better way to compare values?

2011-08-28 Thread Hugo Arts
On Mon, Aug 29, 2011 at 3:19 AM, memilanuk wrote: > Hello, > > Recently picked back up the Python bug, and have started chipping away at > the warm-up exercises over @ codingbat.com. > > I'm getting thru the basic stuff okay, but I'm getting a feeling that maybe > I'm not doing things the 'right'

Re: [Tutor] Better way to compare values?

2011-08-28 Thread memilanuk
There's a few things that can make this a lot shorter. To address your primary question first, the python idiom for this is like so: if 10 in (a, b): it constructs a tuple containing the variables a and b, then checks if the number ten is inside that tuple. simple and straightforward. Now, or

[Tutor] program code for Python Programming for the Absolute Beginner, 3rd ed.?

2011-08-28 Thread Richard D. Moores
The book says the program code is in py3e_source.zip, at www.courseptr.com/downloads , but that leads to the book at with a "View Available Downloads" link that yields no downloads. Does anyone know where py3e_source.zip is? Or

[Tutor] One basic question about the Python's PID of Process object.

2011-08-28 Thread Han Guanghua
Hello, 1. When I tried to run the following code (belonging to one Python program), for the dynamically created object of CUSTOMER as Process type, the printed PID as the following is always the same. Why? 2. Second question: When I changed the os.getpid() to os.getppid() or se