python学习笔记(五)
-
File
a. 打开文件方式(读写两种方式)
1)File = open (’/resources/data/example1.txt’, ‘w’)-
with open (’ example1.txt’ , ‘r’) as file:
b. 文件对象的操作方法
c. 学习对excel 及 csv文件进行操作
import pandas as pd
excel:
xlsx_path=‘file1_xlsx’
df=pd. read_excel (xlsx_path)
df. head()csv:
csv_path=‘file1.csv’
df=pd. read_csv (csv_path)
df. head()
-
-
OS模块
参考:http://www.runoob.com/python/os-file-methods.html
- datatime模块
python中的datetime模块提供了操作日期和时间功能, 该模块提供了五种核心对象:datetime(时间日期类型), date(日期类型), time(时间类型), tzinfo(时区类型), timedelta(时间差类型)。
参考:https://www.jianshu.com/p/1957c4cab0a3
- 类和对象
参考:http://www.runoob.com/python/python-object.html
- 正则表达式
参考:http://www.runoob.com/python/python-reg-expressions.html
- re模块
参考:http://wiki.jikexueyuan.com/project/explore-python/Regular-Expressions/re.html
- http请求
参考:http://docs.python-requests.org/zh_CN/latest/user/quickstart.html
脑子转不过来了感觉,先把参考资料放上来再总结。