【发布时间】:2012-07-30 16:07:24
【问题描述】:
我的问题是为什么 MySQL 行的整数值有一个“L”后缀?以下是详细信息:
下面的字典——为了方便显示,这里人为地格式化了——
{'estimated': '',
'suffix': '',
'typeofread': 'g',
'acct_no': 901001000L,
'counter': 0,
'time_billed': datetime.datetime(2012, 5, 1, 9, 5, 33),
'date_read': datetime.datetime(2012, 3, 13, 23, 19, 45),
'reading': 3018L,
'meter_num': '26174200'}
由 MySQL 数据库表的列组成,压缩后从表中读取一次结果。
我可以通过将这些值传递给 int() 来删除“L”,因此如果该字典位于名为 snapped_read 的变量中,我可以这样做:
int(snapped_read['reading']) 和 3018L 将更改为 3018。
我只是好奇为什么整数会这样显示。
【问题讨论】: