Re: [Tutor] how to run a text file in an interpreter?

2007-04-08 Thread Hugo González Monteverde
Hi Tonu, Tonu Mikk wrote: > I do not know what the author means by running a text file with the > interpreter. I noticed that I came across an obstacle early on in trying > out the code. What plattform are you in? Linux, Windows, Mac? Check out the faqs at: http://www.python.org/doc/faq/windo

Re: [Tutor] Command line args

2007-04-08 Thread Kirk Bailey
Teresa Stanton wrote: > If one argument to a script is provided I am to take the input from it. > I figure that is presented like this: > > filename = sys.argv[1] Try: filename=sys.arg[1] except exception, E: filename='FooBar' > data = open(filename).read() > > But, if none a

Re: [Tutor] Fw: 2) 'WHICH MULTI'

2007-04-08 Thread Alan Gauld
"Terry Carroll" <[EMAIL PROTECTED]> wrote >> One of my tutorial users has come upon a really weird bug. >> >> He has sent a transcript oif his session. Notice that wx >> is not defined yet doing help(wx) produces a strange message. > > Very weird. Here's what I get, weird in a different way..

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Kent Johnson
John Clark wrote: > locals()[var] > > But I am not sure what the pros/cons for doing something like this would > be... locals() should be considered read-only. From the docs: locals( ) Update and return a dictionary representing the current local symbol table. Warning: The content

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Kent Johnson
Andreas Pfrengle wrote: > Bob Gailer wrote: >>> Now I want to change the value of x, but address it via var. >> exec is the statement for doing this, but the need to do this can >> always be met better by using a dictionary instead of global variables. >> > Thanks Bob, the 'exec' saved me. But I

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Bob Gailer
Andreas Pfrengle wrote: > [snip] > looks good if I'm happy with my values inside mydict and don't want to > have sth. like x=5 in the end. But since 'x' is the name of a database > field (I simplified it here for an example), I still see no way around > the exec, so I can change the content of

Re: [Tutor] HTML IN PYTHON AND OTHER DELIGHTS

2007-04-08 Thread Rikard Bosnjakovic
On 4/8/07, Kirk Bailey <[EMAIL PROTECTED]> wrote: > It works. but when you mouse copy and paste, you get this: [...] This has what to do with Python? -- - Rikard - http://bos.hack.org/cv/ ___ Tutor maillist - Tutor@python.org http://mail.python.org

[Tutor] HTML IN PYTHON AND OTHER DELIGHTS

2007-04-08 Thread Kirk Bailey
OK, riddle me this. Using css, I supressed the bullet in unordered lists. The Print line prints an '*' before the item in the listing. so you will see displayed: * abba * abbb * abbc * abbd so the listing can be copied and pasted into a listing in a wiki page. It works. but when you mouse copy

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Andreas Pfrengle
Jordan Greenberg wrote: Andreas Pfrengle wrote: Bob Gailer wrote: Andreas Pfrengle wrote: Hello, I want to change the value of a variable whose name I don't know, but this name is stored as a string in another variable, like: x = 1 var = 'x' Now I want to change the value

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Andreas Pfrengle
Bob Gailer wrote: > Andreas Pfrengle wrote: > >> Hello, >> >> I want to change the value of a variable whose name I don't know, but >> this name is stored as a string in another variable, like: >> >> x = 1 >> var = 'x' >> >> Now I want to change the value of x, but address it via var. > > exec is

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread John Clark
Bob Gailer wrote: >Andreas Pfrengle wrote: >> Hello, >> >> I want to change the value of a variable whose name I don't know, but >> this name is stored as a string in another variable, like: >> >> x = 1 >> var = 'x' >> >> Now I want to change the value of x, but address it via var. > >exec is the

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Bob Gailer
Andreas Pfrengle wrote: > Hello, > > I want to change the value of a variable whose name I don't know, but > this name is stored as a string in another variable, like: > > x = 1 > var = 'x' > > Now I want to change the value of x, but address it via var. exec is the statement for doing this, but t

[Tutor] TCLtutor like python program

2007-04-08 Thread Noufal Ibrahim
Hello everyone, A couple of months ago, I had posted on this list asking about the usefulness of such a program. Something similar to TclTutor (http://www.msen.com/~clif/TclTutor.html) for python. I've spent some time on this and have come up with a crude first version. I'd appreciate if some

[Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Andreas Pfrengle
Hello, I want to change the value of a variable whose name I don't know, but this name is stored as a string in another variable, like: x = 1 var = 'x' Now I want to change the value of x, but address it via var. I'm quite sure I've already seen a solution for this, but right now I don't get it

Re: [Tutor] Movies from jpg files

2007-04-08 Thread Greg Perry
Indeed ;) >Python is Cool :) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Movies from jpg files

2007-04-08 Thread János Juhász
Dear Greg, thanks the link to pymedia. > Maybe PyMedia is what you are looking for: http://www.pymedia.org I looked for it for a while. It is very cool. I made the next short script from one of the samples that make exactly what I wanted. ### import sys, os, glob, Image, time import

Re: [Tutor] reassign

2007-04-08 Thread Tim Golden
linda.s wrote: > Hi, > I have a list: [2,5,8,0,1,7] > how i can randomly reassign the values to different location in the list? > for example: > Time 1: [5,2,8,0,1,7] > Time 2: [8,0,7,1,5,2] > Have a look at the .shuffle function in the random module. TJG ___

[Tutor] reassign

2007-04-08 Thread linda.s
Hi, I have a list: [2,5,8,0,1,7] how i can randomly reassign the values to different location in the list? for example: Time 1: [5,2,8,0,1,7] Time 2: [8,0,7,1,5,2] Thanks! Linda ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listin