2014-03-24 59 views
10

我不斷收到以下錯誤。IOError:[Errno 22]無效模式('wb')或文件名:

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' 

我認爲這是由於在文件名末尾的時間戳。有任何想法嗎?

回答

13

您不能在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)

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

+0

謝謝,我把冒號改成了破折號,它工作 – user3369317

+1

@ user3369317根據[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601),'20140324T172120,545000'也可以。 – glglgl

相關問題