Re: [Tutor] lst file

2008-01-24 Thread Remco Gerlich
Many things could be wrong; perhaps with reading the file, or the lines, or with printing them... Debugging usually consists of what the problem is exactly, where it occurs. First thing I'd look at is seeing whether the lines do get read. I would change "print line" into "print len(line)" and see

Re: [Tutor] creating a nested dictionary

2008-01-24 Thread Remco Gerlich
Of course, I forgot to mention that you can use tuples as dictionary keys. A common idiom is: pdb[(dataset, modulename, parametername, 'value')] = value. And if that works for you, it's much simpler. But you lose the ability to use, say, pdb[dataset][modulename] as a dictionary on its own. Remc

Re: [Tutor] creating a nested dictionary

2008-01-24 Thread Remco Gerlich
Hi, Stream of consciousness answer: So, you want to set things in a dictionary with a statement like d[a][b][c][d] = x, even though d[a] wasn't used before so it's not initialized yet (let alone d[a][b]). Of course, if d is a dict, the d[a] = x works. That's one level deep, and non existing key

Re: [Tutor] random.choice function

2008-01-19 Thread Remco Gerlich
Hi, This line: ch = "So good to see you!","How are you?","Everything good today?","Glad you're here!".split(" ") Creates a tuple with 4 elements: 1. "So good to see you!" 2. "How are you?" 3. "Everything good today?" and 4. "Glad you're here!".split(" "), which is equal to ["Glad","you're", "he

Re: [Tutor] interview questions

2008-01-19 Thread Remco Gerlich
h what they ask, since you have the level of Python knowledge that you claimed. Remco Gerlich On Jan 19, 2008 3:09 AM, Varsha Purohit <[EMAIL PROTECTED]> wrote: > Hello All, >I have an interview in python program development. Can i know some > interview questions in python

Re: [Tutor] run in "deamon" mode?

2008-01-10 Thread Remco Gerlich
Hi, A few days ago, someone posted a "daemon.py" to Reddit, that's supposed to do everything needed. Haven't used it myself, but here it is: http://hathawaymix.org/Software/Sketches/daemon.py Remco On Jan 10, 2008 6:41 AM, Allen Fowler <[EMAIL PROTECTED]> wrote: > Hello, > > How can a make a py

Re: [Tutor] how to compare elements of 2 lists

2008-01-04 Thread Remco Gerlich
Hi, a = [4,3,2,6,7,9] b = [8,6,3,3,2,7] You can turn this into a list of two element tuples with zip(): >>> zip(a,b) [ (4,8),(3,6,),(2,3),(6,3),(7,2),(9,7) ] Now you can loop through that and compare both elements, for instance I believe this list comprehension is what you're looking for: [ t[0

Re: [Tutor] Something I don't understand

2007-12-18 Thread Remco Gerlich
On Dec 18, 2007 2:44 AM, Jim Morcombe <[EMAIL PROTECTED]> wrote: > Below, "student_seats" is a list of the class "student". How do you create the list? And yes, the naming is confusing, but I believe that only masks the class, it shouldn't

Re: [Tutor] How to iterate and update subseqent items in list

2007-12-06 Thread Remco Gerlich
Hi, In this case, I'd go for the simple old fashioned for loop with a boolean: found = False for thing in Things: if thing.value > 0: found = True if found: thing.value = 2 Remco Gerlich On Dec 6, 2007 9:48 AM, ted b <[EMAIL PROTECTED]> wrote: > Can y

Re: [Tutor] Best way of learning

2007-12-06 Thread Remco Gerlich
x27;s fun, and it's a tour of what Python can do - but you'll have to find the way yourself :-) Remco Gerlich ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problems with List Server?

2007-12-06 Thread Remco Gerlich
It arrived. Since you appear to be the only one reporting the problem, perhaps it's something on your end? Remco Gerlich On Dec 3, 2007 11:51 PM, Tim Johnson <[EMAIL PROTECTED]> wrote: > On Monday 03 December 2007, Tim Johnson wrote: > > I appear to be having a weird p

Re: [Tutor] opening a javascript window and reading its source

2007-11-27 Thread Remco Gerlich
ctly normal windows, that contain normal HTML. It's hard to give more help without knowing more about your problem. Hope this helps a little, Remco Gerlich On Nov 27, 2007 1:10 AM, Chiar Nimeni <[EMAIL PROTECTED]> wrote: > i basicly need python to open a certain javascr

Re: [Tutor] How to import modules using the input() command

2007-11-15 Thread Remco Gerlich
rt is a statement, not an expression. However, you can use the built-in function __import__(), that imports the module and returns it. That loads it into memory, but it doesn't add the module to the current namespace. What do you need this for? Remco Gerlich On Nov 15, 2007 4:25 PM, Mihai I

Re: [Tutor] Obtaining image date of creation

2007-11-14 Thread Remco Gerlich
Hi, I'm assuming you don't want the last changed date you see on the file on your PC, but the creation date that the camera stored when the picture was taken. Now I don't know much about that, but I thought it was interesting, so I did some Googling :-) I don't know whether it's always stored, b