a="alizafar"
b=len(a)
lis=[1]*b
d=b
sep=""
c=0
while b>0:
lis[c]=a[c]
c=c+1
b=b-1
c=0
while d>0:
new=lis[c]
print new,
c=c+1
d=d-1
result: a l I z a f a r
当我想打印:alizafar
可以用sys.stdout.write
代替print
import sys
a="alizafar"
b=len(a)
lis=[1]*b
d=b
sep=""
c=0
while b>0:
lis[c]=a[c]
c=c+1
b=b-1
c=0
while d>0:
new=lis[c]
sys.stdout.write(new)
c=c+1
d=d-1
将输出
alizafar