赞
踩
- import csv
- with open('personal GDP.csv', 'r',encoding='utf-8')as f:
- cs = list(csv.reader(f))
- next(reader)# 跳过表头
- title = next(reader)##获取表头,列表形式
- print('标题列:')
-
- 写法一
- ss=[]
- for line in open('./lists.txt','r',encoding='utf-8'):
- ss.append(line.strip())#一次读一行,并且内存不会溢出,去除空行或者空格
-
-
- 写法二:
- with open('./math.py','r',encoding='utf-8') as f:
- for i in f:
- print(i.strip()) #去除空行或者空格
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。