Skip to main content

Thread: Parsing characters' problem in Python


hi. i'm trying parse file has words accent. this, use codecs.open ('nameoffile', 'r', 'utf-8'). then, every line in open document, re.search () find if current line matches pattern. if that's so, print line, , add line list l, using l.append (line).

problem when print lines inside loop words printed fine, accents. after quit loop , try print contents of line l, every single character having accent printed wrong way. don't understand this, before fine , happens when print strings corresponding list.

thoughts. thanks!

quote posted sauronnikko view post
hi. i'm trying parse file has words accent. this, use codecs.open ('nameoffile', 'r', 'utf-8'). then, every line in open document, re.search () find if current line matches pattern. if that's so, print line, , add line list l, using l.append (line).

problem when print lines inside loop words printed fine, accents. after quit loop , try print contents of line l, every single character having accent printed wrong way. don't understand this, before fine , happens when print strings corresponding list.

thoughts. thanks!
can show concrete code exhibits behaviour?


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Parsing characters' problem in Python


Ubuntu

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support