print语句默认每行添加一个换行符 来自2.13
print语句默认每行添加一个换行符
item是列表
当item是元组时,本题运行结果是一样的
>>> for item in ['e','n','h','c']: print(item) e n h c >>> print(item,end=) SyntaxError: invalid syntax >>> print(item,end= ) SyntaxError: invalid syntax >>> print(item,end='') c >>> print(item,end=' ') c >>> for item in ['e','n','h','c']: print(item,end=' ') e n h c >>> print(item,end='') c >>> for item in ['e','n','h','c']: print(item,end='') enhc >>>