Re: [Tutor] help on dic creation

2012-11-06 Thread Mark Lawrence
On 31/10/2012 01:01, Brayden Zhao wrote: def fieldict(filename): D={} with open(filename) as FileObject: for lines in FileObject: linelist=lines.split('\t') Key=linelist[0] ValCity=(linelist[12]).strip() ValState=linelist[13] ValOne=linelist[2]

Re: [Tutor] help on dic creation

2012-11-06 Thread Dave Angel
On 11/06/2012 09:01 AM, Mark Lawrence wrote: > On 31/10/2012 01:01, Brayden Zhao wrote: > >> def fieldict(filename): >>D={} >>with open(filename) as FileObject: >> for lines in FileObject: >>linelist=lines.split('\t') >>Key=linelist[0] >>ValCity=(linelist[12]).s

Re: [Tutor] how to keep track of sorted lists

2012-11-06 Thread Albert-Jan Roskam
> On 11/03/2012 10:40 AM, Albert-Jan Roskam wrote: >>> On 11/03/2012 09:04 AM, Albert-Jan Roskam wrote: >>   Hello, >>> >>> (I haven't run the code, as it was not presented in a form that I > could >>> do a single copy/paste.  So I may have missed some subtlety in the > code.) >> >>

Re: [Tutor] help on dic creation

2012-11-06 Thread Mark Lawrence
On 06/11/2012 14:16, Dave Angel wrote: On 11/06/2012 09:01 AM, Mark Lawrence wrote: On 31/10/2012 01:01, Brayden Zhao wrote: def fieldict(filename): D={} with open(filename) as FileObject: for lines in FileObject: linelist=lines.split('\t') Key=linelist[0]

Re: [Tutor] why different result from two similar ways

2012-11-06 Thread Prasad, Ramit
Steven D'Aprano wrote: > On 30/10/12 12:36, Frank Pontius wrote: > > Hello, > > I have code that works. Then tried to move some of it into function > > IncrementAndRebuildInput, then result changes, I no longer have same result > > as when code in function was inline - why? > > Have you tried run

Re: [Tutor] Help with class example

2012-11-06 Thread Prasad, Ramit
Ramit Prasad wrote: > You would be better off trying to run this from the command > line. I just wanted to clarify on this. The reason you will have a better results running this from the command line is that Python will normally give you very good error traceback. An IDE might hide or obscure t

Re: [Tutor] why different result from two similar ways

2012-11-06 Thread Steven D'Aprano
On 07/11/12 03:31, Prasad, Ramit wrote: Steven D'Aprano wrote: The isdigit method doesn't only work on a single character at a time, it works on an entire string: py> "12345".isdigit() True py> "12345a".isdigit() False I just want to point to the OP (Frank) that this only works for "digit