str.split
と同等のものがPythonでも区切り文字を返しますか?Pythonでデリミタを保持する文字列をトークン化
トークンの一部を処理した後、出力用の空白のレイアウトを保持する必要があります。
例:
>>> s="\tthis is an example"
>>> print s.split()
['this', 'is', 'an', 'example']
>>> print what_I_want(s)
['\t', 'this', ' ', 'is', ' ', 'an', ' ', 'example']
ありがとう!
1 - 興味深い質問、 'splitlines'は' keepends'パラメータが、split' 'のためのそのようなものを持っているようです。奇妙に思えます(http://docs.python.org/library/stdtypes.html#str.splitlines)。 –