Re: Using String for new List name

2009-09-29 Thread Hendrik van Rooyen
On Monday, 28 September 2009 18:54:09 Scott wrote: I am new to Python but I have studied hard and written a fairly big (to me) script/program. I have solved all of my problems by Googling but this one has got me stumped. I want to check a string for a substring and if it exists I want to

Re: Using String for new List name

2009-09-29 Thread Peter Otten
Hendrik van Rooyen wrote: On Monday, 28 September 2009 18:54:09 Scott wrote: I am new to Python but I have studied hard and written a fairly big (to me) script/program. I have solved all of my problems by Googling but this one has got me stumped. I want to check a string for a substring and

Re: Using String for new List name

2009-09-29 Thread nn
On Sep 28, 7:37 pm, Scott scott.freem...@gmail.com wrote: On Sep 28, 2:00 pm, Dave Angel da...@ieee.org wrote: Scott wrote: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append(new stuff). (or [var] if I'm looping through the dict)

Using String for new List name

2009-09-28 Thread Scott
I am new to Python but I have studied hard and written a fairly big (to me) script/program. I have solved all of my problems by Googling but this one has got me stumped. I want to check a string for a substring and if it exists I want to create a new, empty list using that substring as the name

Re: Using String for new List name

2009-09-28 Thread Olof Bjarnason
2009/9/28 Scott scott.freem...@gmail.com: I am new to Python but I have studied hard and written a fairly big (to me) script/program. I have solved all of my problems by Googling but this one has got me stumped. I want to check a string for a substring and if it exists I want to create a

Re: Using String for new List name

2009-09-28 Thread Duncan Booth
Scott scott.freem...@gmail.com wrote: for X in open(file1): Do a test. If true: Y = re.split( , X) Z = Y[0] # This is a string, maybe it is Line42 Z = [] # This doesn't work, I want a new, empty list created called Line42 not Z. Is

Re: Using String for new List name

2009-09-28 Thread Ethan Furman
Scott wrote: I am new to Python but I have studied hard and written a fairly big (to me) script/program. I have solved all of my problems by Googling but this one has got me stumped. I want to check a string for a substring and if it exists I want to create a new, empty list using that

Re: Using String for new List name

2009-09-28 Thread Scott
Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append(new stuff). (or [var] if I'm looping through the dict) This is cool and should do the trick! -Scott Freemire disclosure - Ok, I'm new to *any* language. I've been teaching myself for about 3

Re: Using String for new List name

2009-09-28 Thread Olof Bjarnason
2009/9/28 Scott scott.freem...@gmail.com: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append(new stuff). (or [var] if I'm looping through the dict) This is cool and should do the trick! -Scott Freemire disclosure - Ok, I'm new to *any*

Re: Using String for new List name

2009-09-28 Thread Ethan Furman
Scott wrote: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append(new stuff). (or [var] if I'm looping through the dict) This is cool and should do the trick! -Scott Freemire disclosure - Ok, I'm new to *any* language. I've been teaching

Re: Using String for new List name

2009-09-28 Thread Terry Reedy
Scott wrote: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append(new stuff). The keys are strings, so dictname['line42'].append(new stuff) or for key in dictname.keys(): ... dictname[key] tjr --

Re: Using String for new List name

2009-09-28 Thread Scott
That should actually be dictname[line42].append(new stuff).  Notice the quotes around line42. Good luck!  Python is a fine language, I hope you like it. ~Ethan~ Doh. I sent it before my type, fail, fix cycle had taken place. Got it. Thanks again all! --

Re: Using String for new List name

2009-09-28 Thread Dave Angel
Scott wrote: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append(new stuff). (or [var] if I'm looping through the dict) Nope, you still haven't gotten it. Of course, I really don't know where you're going wrong, since you didn't use the

Re: Using String for new List name

2009-09-28 Thread Scott
On Sep 28, 2:00 pm, Dave Angel da...@ieee.org wrote: Scott wrote: Thank you fine folks for getting back with your answers! So down the road I do dictname[line42].append(new stuff). (or [var] if I'm looping through the dict) Nope, you still haven't gotten it.  Of course, I really don't