1.29pymysql和python踩坑时间格式化
2018-01-30 05:53
323 查看
sql_insert_1 = "INSERT INTO traffic_hourly_devices(date, time, mobile_traffic, desktop_traffic) VALUES(%s,%s,%s,%s)" cursor.execute(sql_insert_1, (devices_data.loc[0, 'date'], devices_data.loc[0, 'time'], devices_data.loc[0,'mobile_traffic'], devices_data.loc[0, 'desktop_traffic']))
一开始使用时间格式化,%Y-%m之类的,数字使用%d, 后来发现都是放屁。统统%s才是王道。
https://stackoverflow.com/questions/5785154/python-mysqldb-issues-typeerror-d-format-a-number-is-required-not-str
相关文章推荐
- Python MySQL 日期时间格式化作为参数
- Python日期时间格式化字符串
- MySql 格式化时间函数
- python 获取时间及格式化
- mysql时间格式化
- python中时间日期格式化符号
- python datetime模块用strftime 格式化时间
- Python 时间戳与格式化时间互转
- Mysql语句中格式化日期时间的方法
- mysql时间格式化,按时间段查询MYSQL语句
- Mysql语句中格式化日期时间的方法
- mysql 日期,mysql时间,mysql日期计算,mysql时间计算,mysql日期时间格式化
- Python 时间格式化
- python中时间日期格式化符号:
- MySql最简单的办法格式化日期和 时间( timestamp), 自定义时间函数快速格式化成年月日,时分秒
- from_unixtime mysql 日期时间格式化
- FROM_UNIXTIME 格式化MYSQL时间戳函数
- 格式化MYSQL时间戳函数FROM_UNIXTIME
- FROM_UNIXTIME 格式化MYSQL时间戳函数
- python 格式化时间字符串