stripping (from item in list)

Martin S shieldfire at gmail.com
Sun Jul 20 11:40:15 CEST 2014


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=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
        c=c-1
    # Now we have a list with only proper lines

While all records in the remaining list now are valid, all also still
have "\n" at the end. What did I miss here?


Regards,

Martin S



More information about the Python-list mailing list