NEWBIE: Tokenize command output
Duncan Booth
duncan.booth at invalid.invalid
Fri May 12 10:25:48 EDT 2006
bruno at modulix wrote:
>> Otherwise, just to be informed, what advantage does rstrip() have over
>> [:-1] (if the two cases are considered uneventfully the same)?
>
> 1/ if your line doesn't end with a newline, line[:-1] will still remove
> the last caracter.
>
In particular, if the last line of the file doesn't end with a newline then
the last line you read won't have a newline to be stripped.
More information about the Python-list
mailing list