Re: [Tutor] Random number selection

2012-01-03 Thread Steven D'Aprano
Dave Angel wrote: Variables with integer values are not 'called." They also don't change values unless you change it. So if you've got a loop, and you want them to have different values each time, then give them different values each time, by calling a function that does return a different v

Re: [Tutor] Which should it be, lists, tuples, dictionary or files?

2012-01-03 Thread Alan Gauld
On 03/01/12 07:31, Devin Jeanpierre wrote: It's probably worth mentioning that shelve is not secure; loading a saved shelf can involve executing arbitrary python code embedded inside it. This probably isn't important for this particular project, but maybe in the future, if you consider using she

Re: [Tutor] Random number selection

2012-01-03 Thread Alan Gauld
On 03/01/12 01:52, shane wrote: I was wondering is there a way to have a variable generate a random integer each time the variable is called. You can call a function to assign a value to a variable, but you can't "call" a variable (unless its assigned to a function but that's another subject en

Re: [Tutor] Which should it be, lists, tuples, dictionary or files? [SOLVED]

2012-01-03 Thread Ken G.
On 01/03/2012 06:28 AM, Alan Gauld wrote: On 03/01/12 07:31, Devin Jeanpierre wrote: It's probably worth mentioning that shelve is not secure; loading a saved shelf can involve executing arbitrary python code embedded inside it. This probably isn't important for this particular project, but may

[Tutor] Parse multi line with re module.

2012-01-03 Thread Ganesh Kumar
Hi Guys, I want parse multiple line. with re.module, this is my given string http://dpaste.com/680760/ I have try with re.compile module. I want parse two line mac address and channel, I have done with for mac address finding r = re.compile("^Searching for OPUSH on (\w\w(:\w\w)+)") for channel f

Re: [Tutor] Parse multi line with re module.

2012-01-03 Thread Joel Goldstick
On Tue, Jan 3, 2012 at 9:13 AM, Ganesh Kumar wrote: > Hi Guys, > > I want parse multiple line. with re.module, this is my given string > http://dpaste.com/680760/ I have try with re.compile module. I want parse > two line mac address and channel, > I have done with for mac address finding > > r =

[Tutor] Still the Python Challenge

2012-01-03 Thread Joaquim Santos
Hi list! After this past week of no PC and no work, I'm again at the Python Challenge Cypher problem. I decided to go with the flow and solve it with maketrans (6 lines of code against the 40 and going I had already...) and it solved it quickly and clean! However, and please be sure I don't want

Re: [Tutor] Parse multi line with re module.

2012-01-03 Thread Robert Sjoblom
On 3 January 2012 16:21, Joel Goldstick wrote: > -- Joel, when you start your emails with this (two dashes) some email readers (gmail among them) will think you're ending your email; I have to expand your post because it thinks that what is hidden is the signature. Just thought you should know.

Re: [Tutor] Still the Python Challenge

2012-01-03 Thread Alan Gauld
On 03/01/12 17:44, Joaquim Santos wrote: - How to correctly populate a list using, for instance, a for loop; I can't tell what you had because the formatting got lost in the email ether... - how to correctly use join to read the said list in a human friendly way... You seem to be do

Re: [Tutor] Parse multi line with re module.

2012-01-03 Thread Joel Goldstick
On Tue, Jan 3, 2012 at 12:51 PM, Robert Sjoblom wrote: > On 3 January 2012 16:21, Joel Goldstick wrote: >> -- > > Joel, when you start your emails with this (two dashes) some email > readers (gmail among them) will think you're ending your email; I have > to expand your post because it thinks tha

[Tutor] Primitive Chess Clock Program Question

2012-01-03 Thread Homme, James
Hi, So far, I know about raw_input as a way to get something from the keyboard into my program. My question is this. Let's say I am trying to subtract time from a value as though someone is thinking and they want to type in a move. If my program prints a prompt to the screen, while the person is

Re: [Tutor] Still the Python Challenge

2012-01-03 Thread Steven D'Aprano
Joaquim Santos wrote: Hi list! After this past week of no PC and no work, I'm again at the Python Challenge Cypher problem. I decided to go with the flow and solve it with maketrans (6 lines of code against the 40 and going I had already...) and it solved it quickly and clean! However, and plea

Re: [Tutor] Primitive Chess Clock Program Question

2012-01-03 Thread Steven D'Aprano
Homme, James wrote: Hi, So far, I know about raw_input as a way to get something from the keyboard into my program. My question is this. Let's say I am trying to subtract time from a value as though someone is thinking and they want to type in a move. If my program prints a prompt to the scree

Re: [Tutor] Primitive Chess Clock Program Question

2012-01-03 Thread Alan Gauld
On 03/01/12 21:28, Steven D'Aprano wrote: I assume you want to display something like this: Enter your next move: 0:30 where the "0:30" is the time remaining, and is constantly updating. When it hits zero, the function returns whether the user has typed anything or not. Assuming Steven has g