print的即时打印会导致换行,要使得print的输出不换行,可以在字符串或者变量后面加个逗号(“,”),如下:
s = "A bird in the hand..." for c in s:
if c.lower() == 'a':
print "X",
else:
print c,
print的即时打印会导致换行,要使得print的输出不换行,可以在字符串或者变量后面加个逗号(“,”),如下:
s = "A bird in the hand..." for c in s:
if c.lower() == 'a':
print "X",
else:
print c,