Re: [Tutor] newbie question about list element manipulation after split()

2008-10-16 Thread Kent Johnson
2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>: > It works fine. It seems that in the file you have there are lines whose > length is less than you should expect Yes, my guess is there is a blank line in the file. Kent ___ Tutor maillist - Tu

Re: [Tutor] newbie question about list element manipulation after split()

2008-10-16 Thread Emad Nawfal (عماد نوفل)
On Thu, Oct 16, 2008 at 4:25 AM, Visvaldas K. <[EMAIL PROTECTED]>wrote: > Hi, > > I feel very stupid, but I am stuck. I could try some workaround, but I want > to understand what I am doing wrong. > > The line: > > for line in open("parameterfile").readlines( ): >print line.split()

Re: [Tutor] newbie question about list element manipulation after split()

2008-10-16 Thread Emad Nawfal (عماد نوفل)
Here is a solution: >>> for line in open('DBAN1001.txt').readlines(): ... line = line.split() ... if len(line) > 1: # This is what makes it work for me. ... print line[1] ... it's have the way that is is prison we It works fine. It seems that in the file you have there are lin

[Tutor] newbie question about list element manipulation after split()

2008-10-16 Thread Visvaldas K.
Hi, I feel very stupid, but I am stuck. I could try some workaround, but I want to understand what I am doing wrong. The line: for line in open("parameterfile").readlines( ): print line.split()# trouble line The "trouble line" works fine in this example. It prints what I w