Windows下OSError: [Errno 22] Invalid argument:OSError:错误解决方法(python3生成新文件时报错)

生成文件名中,使用的时间来生成文件名称
ti = time.strftime(’%Y%m%d:%H:%M:%S’)
查询发现 Windows文件名不允许使用的字符有: < > / \ | : " * ?
改成ti = time.strftime(’%Y%m%d_%H%M%S’)就可以了

猜你喜欢

转载自blog.csdn.net/qq_14920377/article/details/103720214