python read file(f,csv)
Python File Read csv
2023-09-11 14:13:58 时间
import csv
def readfile0():
print('test read file')
in_file = open('C:\python\demo\LiaoXueFeng\data\lianjian_zufang_version_4.csv','r',encoding='UTF-8')
content=in_file.read()
print(content)
def readfile2():
with open('C:\python\demo\LiaoXueFeng\data\lianjian_zufang_version_4.csv','r',encoding='UTF-8') as fin:
for line in fin:
l = [line.split(',') for line in fin]
print(l)
def csvreadfile():
f= open('C:\python\demo\LiaoXueFeng\data\lianjian_zufang_version_4.csv','r',encoding='UTF-8')
s=csv.reader(f)
l=list(s)
print(l)
def wirtefile():
in_file = open('C:\python\demo\LiaoXueFeng\data\lianjian_zufang_version_4.csv','r',encoding='UTF-8')
content=in_file.read()
print(content)
f=open('C:\python\demo\LiaoXueFeng\data\goog2.csv','w',encoding='UTF-8')
f.write(content)
f.close()
in_file.close()
def wirtecsfile():
f = open('C:\python\demo\LiaoXueFeng\data\goog2.csv', 'w', encoding='UTF-8')
ow= csv.writer(f)
ow.writerow('aaaaaaa')
f.close()
csvreadfile()
相关文章
- 通过python切换hosts文件
- 举例讲解Python中的死锁、可重入锁和互斥锁
- [Python] Read and plot data from csv file
- file.wirtelines()方法【python】
- python自动化测试之连接几组测试包实例
- 用Python计算三角函数之acos()方法的使用
- Python 日期和时间_python 当前日期时间_python日期格式化
- [Python] Read from a File in Python
- Python ❤️有没有羡慕别人家做的排序动图?❤️
- Python每日一练(20230322)
- 华为OD机试 - 路灯照明问题(Java & JS & Python)
- Python:利用python语言实现18位身份证号码和15位身份证号码相互转换
- Python:利用python语言绘制多个子图经典案例、代码实现之详细攻略
- python --> Python初阶 --> 基础语法 --> 条件和分支
- 已解决2. Set PROTOCOL_BUPFERS_PYTHON_iMPLEMENTATION=python (but this will use pure-Python parsing and w
- 牵着她——表白不成功算我输(Python实现)
- 最全总结:这几种 Python 命令行参数化的方式真香啊
- 太棒了!11个好用到起飞的「Python字典」知识点!
- 【华为OD机试Python实现】HJ1 字符串最后一个单词的长度(简单)
- Python编程:查看python语法中的关键字keyword
- python 名称前的单下划线
- 看完这篇,python面试稳了
- go语言笔记——还是大爱的我的python,开发效果高,tornado的性能也很不错
- Python库安装之requirements.txt, environment.yml
- 【Python实战】 ---- python 实现 CSDN 的定时自动签到
- 第10讲:Python列表对象查操作之通过切片获取列表中的元素
- Python .py 文件打包成 .exe 文件(Windows平台,python 3.x)