Regex Matching on Readline()
jwwest
jwwest at gmail.com
Thu Dec 20 14:50:34 EST 2007
More information about the Python-list mailing list
Thu Dec 20 14:50:34 EST 2007
- Previous message (by thread): Regex Matching on Readline()
- Next message (by thread): Regex Matching on Readline()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Anyone have any trouble pattern matching on lines returned by readline? Here's an example: string = "Accounting - General" pat = ".+\s-" Should match on "Accounting -". However, if I read that string in from a file it will not match. In fact, I can't get anything to match except ".*". I'm almost certain that it has something to do with the characters that python returns from readline(). If I have this in a file: Accounting - General And do a: line = f.readline() print line I get: A c c o u n t i n g - G e n e r a l Not sure why, I'm a nub at Python so any help is appreciated. They look like spaces to me, but aren't (I've tried matching on spacs too) - james
- Previous message (by thread): Regex Matching on Readline()
- Next message (by thread): Regex Matching on Readline()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list