【发布时间】:2015-05-15 10:19:16
【问题描述】:
当我尝试在 python (2.7) 中进行从字符串到整数的简单类型转换时出现错误:
year = device.time[year_pos:].strip() # This is '1993'
t = int(year) # Throws exception: "UnboundLocalError: local variable 'int' referenced before assignment"
为什么? :)
【问题讨论】:
标签: python integer typeconverter