Python3错误-OSError: [Errno 22] Invalid argument

错误描述:

错误修复:

#报错代码行
 datafile = open('D:\PythonProject\DDU\TestFile\testdata\expect_digA_10.txt')

#修改方式1:
 datafile = open('D:\\PythonProject\\DDU\\TestFile\\testdata\\expect_digA_10.txt')

#修改方式2:
 datafile = open(r'D:\PythonProject\DDU\TestFile\testdata\expect_digA_10.txt')

#修改方式3:
 datafile = open('D:/PythonProject/DDU/TestFile/testdata/expect_digA_10.txt')

 

你可能感兴趣的:(Python编程)