参考资料: shell字符串分割再循环:http://www.shangxueba.com/jingyan/1633455.html linux shell中 if else以及大于.小于.等于逻辑表达式介绍:http://www.jb51.net/article/34332.htm Shell数组:shell数组的定义.数组长度:http://c.biancheng.net/cpp/view/7002.html shell 数组长度:http://blog.csdn.net/shaobingj
my_str = 'hello' # for循环 for v in my_str: print(v) # while 配合迭代器实现字符串的遍历 ite = iter(my_str) while True: try: each = next(ite) except StopIteration: break print(each) results: h e l l o h e l l o