stripping (from item in list)

Martin S shieldfire at
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:
        if x=="#":
            del games[c] #This removes the comments from the file parsed
            games[c].rstrip('\n') #This does nothing, expected to remove \n
    # 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?


Martin S

More information about the Python-list mailing list