编程语言
首页 > 编程语言> > python 在操作文件的时候,遇到的坑

python 在操作文件的时候,遇到的坑

作者:互联网

报错:

OSError: [Errno 22] Invalid argument: 'D:\\data_driven_framework\\TestScript\\UiAutomationReport\\2022-06-26 09:30:54-Auto_Report.html'

 

 

注意:要特别注意,以当前时间命名文件时,时间格式化:"%Y-%m-%d_%H:%M:%S" 修改为"%Y-%m-%d_%H_%M_%S" 就能避免这种错误,注意一定格式化一定不要用冒号

标签:-%,文件,格式化,遇到,python,报错,注意,_%
来源: https://www.cnblogs.com/su-sir/p/16412989.html