Discuss / Python / 问个问题

问个问题

Topic source

print('str(100)+''+str(500)+'='+print(100500)') 各位大神,请问一下这个程序错在哪?

leon332157

#2 Created at ... [Delete] [Delete and Lock User]

print(str(500)+'='+100500) print是一个函数,你不能在print函数里使用print函数. 另外,str是内置语法,会吧括号里的任何东西(前提是可以转换),转换成字符串,所以你这个程序会显示(str(100))而不是100,还有,时刻注意不能混用单双引号


  • 1

Reply