【Error】IOError: [Errno 22] invalid mode
使用python打开或写入文件时会报以下错误IOError: [Errno 22] invalid mode,比如打开f:\nnpm.txt时,可以在地址前面加上r或R,即r'f:\nnpm.txt'即可消除以上错误。
说明:这是使用原始字符串特性,即在字符串的前面已R或者小写字母r开始,则字符串不对\进行转移,直接输出,通常用于表示windows的路径
参考
【Error】IOError: [Errno 22] invalid mode的更多相关文章
- 【Error】IOError: [Errno 22] invalid mode ('wb') or filename
错误描述: IOError: [Errno 22] invalid mode ('wb') or filename: 'C:\\Users\\Viral Patel\\Documents\\GitHu ...
- Python报错IOError: [Errno 22] invalid mode ('r') or filename
IOError: [Errno 22] invalid mode ('r') or filename: 这种错误的出现是在使用built-in函数file()或者open()的时候. 或者是因为文件的 ...
- IOError: [Errno 22] invalid mode ('rb') or filename: 'F:\netData1.mat'
这种错误的出现是在使用built-in函数file()或者open()的时候.或者是因为文件的打开模式不对,或者是文件名有问题.前者的话只需要注意文件是否可读或者可写就可以了.后者则是与文件路径相关的 ...
- IOError: [Errno 22] invalid mode ('rb') or filename: 'C
dataset = scipy.io.loadmat('F:\test_data.mat') 报错 IOError: [Errno ] invalid mode ('rb') or filename: ...
- python IOError: [Errno 22] invalid mode ('r') or filename:
如果你是报这个错误,可能是因为你的文件路径中的中文字符太多的缘故. 你可以将路径或者文件名称改为英文试试.
- Python IOError: [Errno 22] invalid mode ('r') 解决方法
环境 Anaconda3 Python 3.6, Window 64bit 书籍 O'Reilly出版的Wes McKinney编的<Python for Data Analysis> r ...
- 【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_ ...
- python使用open的OSError: [Errno 22] Invalid argument错误
这两天在写一个新闻类的spider时,遇到了OSError: [Errno 22] Invalid argument这个错误,苦恼的两天,无果.后来通过请教学长,发现原来是打开的文件名中含有一些系统的 ...
- Python创建文件报错OSError:[Errno 22] Invalid argument处理
问题: windows平台下使用python open函数w模式打开文件报错“OSError: [Errno 22] Invalid argument: '../news/“消费升维”成零售业新风口? ...
随机推荐
- hdu6121 Build a tree
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=6121 题面: Build a tree Time Limit: 2000/1000 MS (J ...
- Winter-2-STL-G Team Queue 解题报告及测试数据
Time Limit:3000MS Memory Limit:0KB Description Queues and Priority Queues are data structures wh ...
- OpenStack学习(二)
虚机安装成功后,,学习虚机的管理 虚机的管理主要使用以下命令 1. 虚机的管理 a. 创建 virt-install --name=wintest01 --ram 512 --vcpus=2 --di ...
- 对Java ConcurrentHashMap的一些了解
①引言(为什么要使用ConcurrentHashMap) 因为多线程环境下,使用Hashmap进行put操作会引起死循环,导致CPU利用率接近100%,所以在并发情况下不能使用HashMap. Has ...
- python替换一个文件里面的特定内容
f = open("1.txt", "r", encoding="utf-8") f_new = open("2.txt" ...
- servlet中通过getWriter()获取out返回给浏览器出现中文乱码问题
感谢博主https://blog.csdn.net/louyongfeng3613/article/details/50160317 在Servlet编程中,经常需要通过response对象将一些信息 ...
- python_threading模块实现多线程详解(转)
综述 Python这门解释性语言也有专门的线程模型,Python虚拟机使用GIL(Global Interpreter Lock,全局解释器锁)来互斥线程对共享资源的访问,但暂时无法利用多处理器的优势 ...
- ABP官方文档翻译 2.4 日志
日志 服务端 获取记录器 基类日志记录器 配置 Abp.Castle.Log4Net包 客户端 服务端 ABP使用Castle Windsor`s 日志设备.它可以使用不同的日志类库:Log4Net, ...
- java单例模式之懒汉式分析
转自:http://blog.csdn.net/withiter/article/details/8140338 今天中午闲着没事,就随便写点关于Java单例模式的.其实单例模式实现有很多方法,这里我 ...
- Thinkphp5.0实战开发二------自动生成目录结构
序言 ThinkPHP5.0 具备自动创建功能,可以用来自动生成需要的模块及目录结构和文件等,自动生成主要调用\think\Build 类库.ThinkPHP5.0中模块文件夹在application ...