python把字符串 变成数组 然后遍历打印
例子:将字符串"hello world"变成数组,然后遍历打印每个字符。
string = "hello world"
array = list(string)
for char in array:
print(char)
输出结果:
h
e
l
l
o
w
o
r
l
d
原文地址: https://www.cveoy.top/t/topic/czRD 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
例子:将字符串"hello world"变成数组,然后遍历打印每个字符。
string = "hello world"
array = list(string)
for char in array:
print(char)
输出结果:
h
e
l
l
o
w
o
r
l
d
原文地址: https://www.cveoy.top/t/topic/czRD 著作权归作者所有。请勿转载和采集!