Printing 如何在循环中的同一行上打印?
我正在尝试将纸牌游戏的结果打印在同一行上,下面是我想要的输出: 以下是我得到的: 这是我的密码:Printing 如何在循环中的同一行上打印?,printing,python-3.x,console-output,Printing,Python 3.x,Console Output,我正在尝试将纸牌游戏的结果打印在同一行上,下面是我想要的输出: 以下是我得到的: 这是我的密码: for List in tableau: print print ("Row", Row, ":", end="") print Row += 1 for x in List: print (x, end="") 我正在使用Python 3,谢谢。您需要在Python 3中调用print
for List in tableau:
print
print ("Row", Row, ":", end="")
print
Row += 1
for x in List:
print (x, end="")
我正在使用Python 3,谢谢。您需要在Python 3中调用
print
作为函数:
for List in tableau:
print() # Right here
print ("Row", Row, ":", end="")
Row += 1
for x in List:
print (x, end="")
看看Python 2和Python 3之间的输出差异:
for List in tableau:
print() # Right here
print ("Row", Row, ":", end="")
Row += 1
for x in List:
print (x, end="")
Python 2:
>>> print
>>>
>>> print
<built-in function print>
>>> print()
>>>
Python 3:
>>> print
>>>
>>> print
<built-in function print>
>>> print()
>>>
在Python 3中,您需要调用
print
作为函数:
for List in tableau:
print() # Right here
print ("Row", Row, ":", end="")
Row += 1
for x in List:
print (x, end="")
看看Python 2和Python 3之间的输出差异:
for List in tableau:
print() # Right here
print ("Row", Row, ":", end="")
Row += 1
for x in List:
print (x, end="")
Python 2:
>>> print
>>>
>>> print
<built-in function print>
>>> print()
>>>
Python 3:
>>> print
>>>
>>> print
<built-in function print>
>>> print()
>>>
您需要将
print
s更改为函数
for List in tableau:
print()
print ("Row", Row, ":", end="")
print()
Row += 1
for x in List:
print (x, end="")
您需要将
print
s更改为函数
for List in tableau:
print()
print ("Row", Row, ":", end="")
print()
Row += 1
for x in List:
print (x, end="")
这应该能奏效。这对我有用
这应该能奏效。这对我很有效。可能的重复可能的重复这可能就是一个明显的方法;)这可能就是一个显而易见的方法;)