上一页 1 ··· 151 152 153 154 155 156 157 158 159 ··· 204 下一页
摘要: 转载:https://automatetheboringstuff.com/ 转载:https://automatetheboringstuff.com/2e/chapter10/ import os for folderName, subfolders, filenames in os.walk( 阅读全文
posted @ 2020-02-28 23:39 小白龙白龙马 阅读(172) 评论(0) 推荐(0)
摘要: import zipfile import os print(os.getcwd()) #C:\Users\del\PycharmProjects\untitled1\cs newZip = zipfile.ZipFile('C:\\Users\\del\\Desktop\\新建文件夹 (2)\\新 阅读全文
posted @ 2020-02-28 23:19 小白龙白龙马 阅读(1682) 评论(0) 推荐(0)
摘要: 全部解压缩到指定路径里: import zipfile import os print(os.getcwd()) #C:\Users\del\PycharmProjects\untitled1\cs exampleZip = zipfile.ZipFile('C:\\Users\\del\\Desk 阅读全文
posted @ 2020-02-28 23:07 小白龙白龙马 阅读(1039) 评论(0) 推荐(0)
摘要: import zipfileexampleZip = zipfile.ZipFile('C:\\Users\\del\\Desktop\\新建文件夹 (2)\\新建文件夹 (2).zip')for zip_file in exampleZip.namelist(): try: zip_file = 阅读全文
posted @ 2020-02-28 22:50 小白龙白龙马 阅读(1461) 评论(0) 推荐(0)
摘要: x = '111,222,333,444\n' print(x) users = [ ] print(x[:-1]) print(' ') print(x[:-1].split(',')) print(' ') for line in x[:-1].split(','): print(line) u 阅读全文
posted @ 2020-02-28 09:15 小白龙白龙马 阅读(1437) 评论(0) 推荐(0)
摘要: import csv users = [] with open('C:\\Users\\del\\Desktop\\123.csv', 'r') as csvfile: reader = csv.reader(csvfile) for row in reader: print(row) users. 阅读全文
posted @ 2020-02-28 09:08 小白龙白龙马 阅读(184) 评论(0) 推荐(0)
摘要: 转载:https://www.py.cn/spider/advanced/14381.html import csv with open('C:\\Users\\del\\Desktop\\123.csv', 'r') as csvfile: reader = csv.reader(csvfile) 阅读全文
posted @ 2020-02-28 03:23 小白龙白龙马 阅读(264) 评论(0) 推荐(0)
摘要: 一、文件操作的常用方法: 1、read():从光标位置开始读取整个文件剩下的内容,注意是从光标位置开始,不一定是读取整个文件。 #第一次读取: f=open('test.txt','r') print(f.read()) f.close() #自恐多情损梵行,入山又怕误倾城.世间安得双全法,不负如来 阅读全文
posted @ 2020-02-28 01:55 小白龙白龙马 阅读(622) 评论(0) 推荐(0)
摘要: 转载:https://www.cnblogs.com/thebear/p/9560939.html """读文件""" # open()函数打开一个文件对象,传入文件名(路径)和标示符(读,写等操作) # 'r' 标示符标示 '读' # read()方法一次读取文件的全部内容,用一个str表示 # 阅读全文
posted @ 2020-02-28 01:52 小白龙白龙马 阅读(692) 评论(0) 推荐(0)
摘要: 下面两种方法都可以,读取一个图片然后保存到另外一个地方f = open('C:\\Users\\del\\Desktop\\123.gif','rb') s = f.read() f.close() with open('C:\\Users\\del\\Desktop\\新建文件夹\\1.png', 阅读全文
posted @ 2020-02-28 01:45 小白龙白龙马 阅读(529) 评论(0) 推荐(0)
上一页 1 ··· 151 152 153 154 155 156 157 158 159 ··· 204 下一页