Python读取csv文件,,创建一个csv文件,
Python读取csv文件,,创建一个csv文件,
创建一个csv文件,命名为data.csv,文本内容如下:
root,123456,login successfullyroot,wrong,wrong passwordwrong,123456,nonexistent username,123456,username is nullroot,,password is null
使用Excel打开如图:
利用Python内置的csv读取内容:
import csvwith open('data.csv', 'r', encoding='utf-8')as f: reader = csv.reader(f) for i in reader: print(i)
输出结果:
['root', '123456', 'login successfully']['root', 'wrong', 'wrong password']['wrong', '123456', 'nonexistent username']['', '123456', 'username is null']['root', '', 'password is null']
Python读取csv文件
相关内容
- 初识Python-文件类型(入坑篇),,一、源代码【.py】
- python hough变换检测直线的实现方法 - python,,文章来源:
- 使用Eclipse 搭建Python 开发环境,,1.1下载Pytho
- python学习(10),,习题4: 写一个函数
- RabbitMQ 实现实现基本通信及订单处理,, 一.基本使
- python3创建表及表数据;,,创建表,参考代码如下
- Python爬虫进阶——JsonPath使用案例,,如果一个网站采用
- Python 发送邮件,, Python 发
- 001 我和Python的第一次亲密接触,,从IDLE启动Pyt
- 【python爬虫】selenium的三种等待,,一、 强制等待 第
评论关闭