print(“anything”,end=”anything”)是Python3.5中的语法,想在2.7中使用,就需要在首行添加from future import print_function
下面是九九乘法表例子:
from __future__ import print_function
num1 = 1
num2 = 1
while num1<=9:
num2=1
while num2<=num1:
print(str(num2)+"*"+str(num1)+"="+str(num1*num2),end="t")
num2+=1
print()
num1+=1
最后
以上就是大力八宝粥最近收集整理的关于如何在Python2.7中使用Python3.5中的语法end=的全部内容,更多相关如何在Python2.7中使用Python3.5中内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复