【发布时间】:2015-08-06 01:41:26
【问题描述】:
我想知道如何逐字遍历字符串。
string = "this is a string"
for word in string:
print (word)
上面给出了一个输出:
t
h
i
s
i
s
a
s
t
r
i
n
g
但我正在寻找以下输出:
this
is
a
string
【问题讨论】:
-
与之前的问题非常密切相关(虽然不是完全重复)是stackoverflow.com/questions/6181763/…
标签: python