python repr 函数调用时不使用引号
python repr function not using quotes when called
这是一个代码片段,我在其中对两个相等的值调用了 repr,但在进行比较时,它们并不相等。所以我使用 repr 进行调试,第二个 repr 调用不使用单引号打印。这怎么可能?
ID = data_match[4] #current id
print(repr(ID)) #'550699433'
if user in dict:
for keys,values in online.items():
print(repr(values)) #550699433
print(values == ID) #False
澄清一下,我希望 values == ID 打印为真,并且我正在使用 repr 调试它为什么打印为假。同样没有 repr 他们都打印 550699433.
开玩笑的,看看你的values和ID是不是同一类型
print(type(values))
print(type(ID))
这是一个代码片段,我在其中对两个相等的值调用了 repr,但在进行比较时,它们并不相等。所以我使用 repr 进行调试,第二个 repr 调用不使用单引号打印。这怎么可能?
ID = data_match[4] #current id
print(repr(ID)) #'550699433'
if user in dict:
for keys,values in online.items():
print(repr(values)) #550699433
print(values == ID) #False
澄清一下,我希望 values == ID 打印为真,并且我正在使用 repr 调试它为什么打印为假。同样没有 repr 他们都打印 550699433.
开玩笑的,看看你的values和ID是不是同一类型
print(type(values))
print(type(ID))