形如abcde或者12345的字符串,如何分割成1,2,3,4,5
具体如图,我之前恰巧做过
用求余数和求整数的方法,引入数组循环分割
Str="12345"; List=[]; i=0; while i<len(Str): print Str[i]; List.insert(i, Str[i]); i+=1; print List
字符串本身就是字符元组。不存在分割问题str = "1234"for s in str:print s