Check for new line character?
John Roth
newsgroups at jhrothjr.com
Sun Oct 26 18:18:46 EST 2003
More information about the Python-list mailing list
Sun Oct 26 18:18:46 EST 2003
- Previous message (by thread): Check for new line character?
- Next message (by thread): Check for new line character?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Yazar Yolait" <yazar at hotmail.com> wrote in message news:bnhk76$v3klv$1 at ID-198839.news.uni-berlin.de... > I want to skip lines in a file that are blank and that start with "&". So I > strip(None) them and then startswith("&") but the only problem is if the > line has nothing but white space and I strip(None) it then it contains > nothing but a new line character right? So how do I check if the line > contains a new line character? I can no longer use isspace(). if line == '\n': whatever... If you're using <file>.readline() to read the lines, then each line (except the eof signal) ***will*** end with a newline, and it will not have a newline internally, so there's no need for a complicated check. After you strip blanks, an all blank line will contain exactly one character: the newline. John Roth > >
- Previous message (by thread): Check for new line character?
- Next message (by thread): Check for new line character?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list