Re: stripping (from item in list)

2014-07-20 Thread Terry Reedy
On 7/20/2014 5:40 AM, Martin S wrote: while c >=0: x=games[c][0] if x=="#": del games[c] #This removes the comments from the file parsed else: games[c].rstrip('\n') #This does nothing, expected to remove \n Chris already pointed out error he

Re: stripping (from item in list)

2014-07-20 Thread Chris Angelico
On Sun, Jul 20, 2014 at 8:06 PM, Martin S wrote: > And yes, definately should be able to build a better parser ... I want > it to work first. Fair enough. That's why I answered your actual question before mentioning that as a tacked-on almost postscript. :) ChrisA -- https://mail.python.org/mai

Re: stripping (from item in list)

2014-07-20 Thread Martin S
Craps should have guessed that was the problem. Must have misunderstood the examples. But thanks =) And yes, definately should be able to build a better parser ... I want it to work first. /Martin S 2014-07-20 11:57 GMT+02:00 Chris Angelico : > On Sun, Jul 20, 2014 at 7:40 PM, Martin S wrote:

Re: stripping (from item in list)

2014-07-20 Thread Chris Angelico
On Sun, Jul 20, 2014 at 7:40 PM, Martin S wrote: > games[c].rstrip('\n') #This does nothing, expected to remove \n > > While all records in the remaining list now are valid, all also still > have "\n" at the end. What did I miss here? Strings don't change. When you call rstrip(), it r

stripping (from item in list)

2014-07-20 Thread Martin S
While preparing to my gui to the app I made I thought it would be nice to be able to parse a text file with results using the same tool. So: I read a result file to a list, and every record gets appended with "\n" ... OK, so I look up how to remove it. And this doesn't work while c >=0: x