37,721
社区成员
发帖
与我相关
我的任务
分享
albums = ('1', '2', '3', '4')
years = ('0', '0', '0', '0')
for yr in zip(albums, years):
print yr
albums = ('1', '2', '3', '4')
years = ('0', '0', '0', '0')
for album, yr in zip(albums, years):
print yr, album
a='das'
a
print a
print的结果的确是不带引号的
因为Python中一切都是对象,print函数实际上是调用了对象的__str__()方法
object.__str__(self)
Called by the str() built-in function and by the print statement to compute the “informal” string representation of an object. This differs from __repr__() in that it does not have to be a valid Python expression: a more convenient or concise representation may be used instead. The return value must be a string object.
猜测原因应该是在这,所谓的informal指的就是我们日常生活使用的字符串形式,因此不带引号print [yr, album]