Discuss / Python / 关于在循环中每一次print都默认空行的问题

关于在循环中每一次print都默认空行的问题

Topic source

Yumeey

#1 Created at ... [Delete] [Delete and Lock User]
在此插入代码

for name in L: print('Hello,%s!'% name)

在这里输出的是: Hello, 'Bart' Hello, 'Lisa' HEllo, 'Adam'

就是说每一次执行print时都会默认空行,那如果我想要实现: Hello, 'Bart' Hello, 'Lisa' HEllo, 'Adam'

该怎么做?

江思年

#2 Created at ... [Delete] [Delete and Lock User]
在此插入代码

names=['machael','cam','phill','clare'] for name in names:print('hello',name)


  • 1

Reply