Linuxのpython 2.7のスペース/タブ/改行をすべて削除しようとしています。私は仕事をするべきである、これを書いたストリップスペース/タブ/改行 - python
:
myString="I want to Remove all white \t spaces, new lines \n and tabs \t"
myString = myString.strip(' \n\t')
print myString
出力:
I want to Remove all white spaces, new lines
and tabs
を何をする単純なことのように思える、まだ私はここで何かが欠けています。私は何かを輸入すべきか?この関連の質問への答えうち
いいえnewlinesandtabs。 –
が役に立つかもしれません:http://stackoverflow.com/questions/8928557/python-splitting-string-by-all-space-characters – newtover
これは私のために働いていました:[空白を整える方法(タブを含む)?] [1] S = s.strip( '\ Tの\ n個の\ R') [1]:http://stackoverflow.com/questions/1185524/how-to-trim-whitespace- include-tabs – stamat