IOError:[Errno 22]无效模式(“wb”)或文件名:

2024-06-13 03:42:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直有以下错误。

IOError: [Errno 22] invalid mode ('wb') or filename: 'C:\\Users\\Viral Patel\\Documents\\GitHub\\3DPhotovoltaics\\Data_Output\\Simulation_Data\\Raw_Data\\Raw_Simulation_Data_2014-03-24 17:21:20.545000.csv'

我认为这是由于文件名末尾的时间戳造成的。有什么想法吗?


Tags: ordatarawmode错误filenameusersdocuments
1条回答
网友
1楼 · 发布于 2024-06-13 03:42:26

在Windows文件名中不能使用:,请参见Naming Files, Paths, and Namespaces ;它是保留字符之一:

  • The following reserved characters:

    • < (less than)
    • > (greater than)
    • : (colon)
    • " (double quote)
    • / (forward slash)
    • \ (backslash)
    • | (vertical bar or pipe)
    • ? (question mark)
    • * (asterisk)

使用不在保留字符列表中的其他字符。

相关问题 更多 >