使用python打开或写入文件时会报以下错误IOError: [Errno 22] invalid mode,比如打开f:\nnpm.txt时,可以在地址前面加上r或R,即r'f:\nnpm.txt'即可消除以上错误。
说明:这是使用原始字符串特性,即在字符串的前面已R或者小写字母r开始,则字符串不对\进行转移,直接输出,通常用于表示windows的路径

参考

【Error】IOError: [Errno 22] invalid mode的更多相关文章

  1. 【Error】IOError: [Errno 22] invalid mode ('wb') or filename

    错误描述: IOError: [Errno 22] invalid mode ('wb') or filename: 'C:\\Users\\Viral Patel\\Documents\\GitHu ...

  2. Python报错IOError: [Errno 22] invalid mode ('r') or filename

    IOError: [Errno 22] invalid mode ('r') or filename: 这种错误的出现是在使用built-in函数file()或者open()的时候. 或者是因为文件的 ...

  3. IOError: [Errno 22] invalid mode ('rb') or filename: 'F:\netData1.mat'

    这种错误的出现是在使用built-in函数file()或者open()的时候.或者是因为文件的打开模式不对,或者是文件名有问题.前者的话只需要注意文件是否可读或者可写就可以了.后者则是与文件路径相关的 ...

  4. IOError: [Errno 22] invalid mode ('rb') or filename: 'C

    dataset = scipy.io.loadmat('F:\test_data.mat') 报错 IOError: [Errno ] invalid mode ('rb') or filename: ...

  5. python IOError: [Errno 22] invalid mode ('r') or filename:

    如果你是报这个错误,可能是因为你的文件路径中的中文字符太多的缘故. 你可以将路径或者文件名称改为英文试试.

  6. Python IOError: [Errno 22] invalid mode ('r') 解决方法

    环境 Anaconda3 Python 3.6, Window 64bit 书籍 O'Reilly出版的Wes McKinney编的<Python for Data Analysis> r ...

  7. 【Selenium】【BugList9】windows环境,fp = open("./"+ time.strftime("%Y-%m-%d %H:%M:%S") + " result.html",'wb'),报错:OSError: [Errno 22] Invalid argument: './2018-09-05 10:29:32 result.html'

    [代码] if __name__=="__main__": suite = unittest.TestSuite() suite.addTest(Baidu("test_ ...

  8. python使用open的OSError: [Errno 22] Invalid argument错误

    这两天在写一个新闻类的spider时,遇到了OSError: [Errno 22] Invalid argument这个错误,苦恼的两天,无果.后来通过请教学长,发现原来是打开的文件名中含有一些系统的 ...

  9. Python创建文件报错OSError:[Errno 22] Invalid argument处理

    问题: windows平台下使用python open函数w模式打开文件报错“OSError: [Errno 22] Invalid argument: '../news/“消费升维”成零售业新风口? ...

随机推荐

  1. Get started on your own KD 8 custom colorway

    The 2009 Summer time Nike Basketball revealed the Cheap KD 8 and revealed three MVP-inspired colors ...

  2. 2017 Multi-University Training Contest - Team 3 hdu6060 RXD and dividing

    地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6060 题目: RXD and dividing Time Limit: 6000/3000 M ...

  3. fir.im 测试包下载工具--FIRReader 的图文介绍

    fir.im 是一个供开发者上传测试包(也可以是企业的正式包)的网站.该网站提供了接口访问应用资源.下面要介绍的这个应用对接了这些接口,供用户方便下载应用. 先来看下应用截图吧! 主要有以下功能点:1 ...

  4. java文件遍历

    用java实现本地文件的遍历,顺便了解了下集合框架,注意java中还有Collections,是一个强大的工具,注意其与Collection的区别,在 for(File f: listFiles) 中 ...

  5. 自制Linux映像和发行版Robomind

    通常ARM开发板厂商会提供已编译好的Linux映像供用户使用.我手上的MarS Board的厂商提供了Ubuntu映像,只是版本有点老,文件系统也比较大.之前我已经移植了较新的Linux内核,现在我想 ...

  6. 深入学习js之——词法作用域和动态作用域

    开篇 当我们在开始学习任何一门语言的时候,都会接触到变量的概念,变量的出现其实是为了解决一个问题,为的是存储某些值,进而,存储某些值的目的是为了在之后对这个值进行访问或者修改,正是这种存储和访问变量的 ...

  7. Java学习第三周摘要

    20145307<Java程序设计>第三周学习总结 教材学习内容总结 认识对象 类类型 Java可区分为基本类型和类类型两大类型系统,其中类类型也称为参考类型.sun就是一个类类型变量,类 ...

  8. 20145314郑凯杰《信息安全系统设计基础》第八周复习总结 Part A

    20145314郑凯杰<信息安全系统设计基础>第八周复习总结 Part A 学习知识点内容总结 复习线索:http://group.cnblogs.com/topic/73069.html ...

  9. 20145322《Java程序设计》第5次实验报告

    20145322<Java程序设计>第5次实验报告 实验内容 1.根据所学内容,编写代码实现服务器与客户端 2.掌握密码技术的使用 3.设计安全传输系统,客户端中输入明文,利用DES算法加 ...

  10. 关于makefile的那些事儿

    最近越来越感觉到,在linux下面身为一个程序员,不会makefile就不是一个合格的程序员,所以今天我们介绍下常用的makefile编写. 了解知识: 编译:把高级语言书写的代码转换为机器可识别的机 ...