ValueError: time data '5:45:56 AM' does not match format '%I:%M:%S %p'
来源:互联网 发布:淘宝店铺卖 编辑:程序博客网 时间:2024/04/18 05:32
最近在使用最新Anaconda 4.2.0的PyQt5时报如下错:
Traceback (most recent call last): File "/opt/package/test1.py", line 81, in <module> File "/opt/package/test1.py", line 41, in __init__ print 6666, test(time_str) File "/opt/sumscope/cdh/package//test1.py", line 26, in test return datetime.datetime.strptime(time_str, '%I:%M:%S %p').strftime('%H:%M:%S') File "/opt/anaconda/lib/python2.7/_strptime.py", line 332, in _strptime (data_string, format))ValueError: time data '5:45:56 AM' does not match format '%I:%M:%S %p'
这是因为Linux设置的语言环境为中文导致,修改为英文就行了
发法一:
export LANG=en_US.utf8
方法二:
修改/etc/profile文件,在该文件最后加上export LANG=en_US.utf8
注:查看Linux语言环境命令
[root@localhost ~]# localeLANG=en_US.utf8LC_CTYPE="en_US.utf8"LC_NUMERIC="en_US.utf8"LC_TIME="en_US.utf8"LC_COLLATE="en_US.utf8"LC_MONETARY="en_US.utf8"LC_MESSAGES="en_US.utf8"LC_PAPER="en_US.utf8"LC_NAME="en_US.utf8"LC_ADDRESS="en_US.utf8"LC_TELEPHONE="en_US.utf8"LC_MEASUREMENT="en_US.utf8"LC_IDENTIFICATION="en_US.utf8"LC_ALL=
0 0
- ValueError: time data '5:45:56 AM' does not match format '%I:%M:%S %p'
- literal does not match format string 解决办法
- literal does not match format string
- ORA-01861: literal does not match FORMat string 错误原因
- Oracle异常ORA-01861: literal does not match format string。
- ORA-01861: literal does not match format string 错误!
- ORA-01861: literal does not match format string
- 关于ORA-01861: literal does not match format string
- Oracle 异常 ORA-01861: literal does not match format string
- SSD-tensorflow:ValueError: number of input channels does not match corresponding dimension of filter
- ORA-01843: not a valid month;ORA-01855: AM/A.M. or PM/P.M. required
- i am not uncleGao.
- time stamp data format
- Oracle 异常 ORA-01861: literal does not match format string(字符串格式不匹配)
- Oracle 异常 ORA-01861: literal does not match format string(字符串格式不匹配)
- oracle学习笔记【 ORA-01861: literal does not match format string(字符串格式不匹配)】
- 解决:Oracle 异常 ORA-01861: literal does not match format string(字符串格式不匹配)
- 关于时间比较,ORA-01861: literal does not match format string
- JSP基础(2)
- 喜
- MySQL DATE_FORMAT()函数
- Kotlin - ==、===和equals
- ABCDE 排列组合
- ValueError: time data '5:45:56 AM' does not match format '%I:%M:%S %p'
- java List(分割)分批处理
- hadoop安装配置中的权限管理
- maven 多环境打包
- javascript强制转换详解
- C#中分布式事务的超时处理问题
- 网掩码与子网划分
- SpringMVC - @ModelAttribute运用详解-1
- 配置composer代理