前言
相信大家在做爬虫项目的时候,都会用到创建文件用于保存数据到本地吧,下面就为大家介绍几个创建文件夹的几种方式吧,让你以后更加方便的使用各种方式,提高你的代码效率,现在就看看吧
每个网站都是一个单独的项目(文件夹)
![webp](https://upload-images.jianshu.io/upload_images/16959493-e6e67050fbd89562.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/502/format/webp)
每个网站都是一个单独的项目(文件夹)
![webp](https://upload-images.jianshu.io/upload_images/16959493-f3b8dae45e43ac5c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/545/format/webp)
创建一个新文件
![webp](https://upload-images.jianshu.io/upload_images/16959493-5e5ebd3cfe5c691d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/363/format/webp)
学习从来不是一个人的事情,要有个相互监督的伙伴,工作需要学习python或者有兴趣学习python的伙伴可以私信回复小编“学习” 获取资料,一起学习
将数据添加到现有文件中
![webp](https://upload-images.jianshu.io/upload_images/16959493-308665ce7a10d805.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/417/format/webp)
删除文件的内容
![webp](https://upload-images.jianshu.io/upload_images/16959493-bf9c7a9333f9dc7c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/421/format/webp)
删除文件的内容
![webp](https://upload-images.jianshu.io/upload_images/16959493-e5664f552de8d41c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/479/format/webp)
遍历一个集合,每个项都是文件中的一行
![webp](https://upload-images.jianshu.io/upload_images/16959493-a4075ce7dc9dee36.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/445/format/webp)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/69912078/viewspace-2640693/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/69912078/viewspace-2640693/