On 05.06.2014 20:52, Ryan Hiebert wrote: > 2014-06-05 13:42 GMT-05:00 Johannes Bauer <dfnsonfsdu...@gmx.de>: > >> On 05.06.2014 20:16, Paul Rubin wrote: >>> Johannes Bauer <dfnsonfsdu...@gmx.de> writes: >>>> line = line[:-1] >>>> Which truncates the trailing "\n" of a textfile line. >>> >>> use line.rstrip() for that. >> >> rstrip has different functionality than what I'm doing. > > How so? I was using line=line[:-1] for removing the trailing newline, and > just replaced it with rstrip('\n'). What are you doing differently?
Ah, I didn't know rstrip() accepted parameters and since you wrote line.rstrip() this would also cut away whitespaces (which sadly are relevant in odd cases). Thanks for the clarification, I'll definitely introduce that. Cheers, Johannes -- >> Wo hattest Du das Beben nochmal GENAU vorhergesagt? > Zumindest nicht öffentlich! Ah, der neueste und bis heute genialste Streich unsere großen Kosmologen: Die Geheim-Vorhersage. - Karl Kaos über Rüdiger Thomas in dsa <hidbv3$om2$1...@speranza.aioe.org> -- https://mail.python.org/mailman/listinfo/python-list