これに対する以前の回答を見てきました ( python how to remove this n from string or list、remove a list item from a list、python remove whitespace in string )が、解決策を機能させることができません。
次のような単一の要素を持つリストがあります。
list = [u'\r\n\r\n\r\n \r\n \r\n \r\n 123 Main St., Peoria\r\n \r\n\r\n \r\n |\r\n \r\n \r\n \r\n \r\n 123-456-789\r\n \r\n \r\n \r\n ']
住所と電話番号があり、これを返してもらいたいのは次のとおりです。
123 Main St., Peoria;123-456-789
私は次のようなものを試しました:
str(list).strip(' \r\n\t')
と
str(list).replace('\r','')
しかし、それらは機能しないので、おそらくユニコードの問題だと思いますか? どうすれば回避できますか?