"""
"""
python 源文件处理
Yaml
可读性高,用来表达数据序列化的格式,常用作配置文件使用
Json
轻量级的数据交换语言,易于阅读,传输由属性值或序列性的值组成的数据对象
Excel
"""
from openpyxl import Workbook
from openpyxl.utils import get_column_letter
"""
python-Excel
openpyxl
"""
wb = Workbook()
dest_filename = "empty_book.xlsx"
dest_filename.encode('utf-8')
ws = wb.active
ws.title = "range names"
ws = wb.create_sheet(title="my sheet")
for i in range(1, 30):
ws.cell(column=1, row=i).value = 'test'
wb.save(filename=dest_filename)
# 读取文件
from openpyxl import load_workbook
wb = load_workbook(filename='empty_book.xlsx')
sheet_ranges = wb['range names']
print(sheet_ranges['D18'].value)
for i in range(1, 31):
print(sheet_ranges.cell(column=1, row=1).value)
"""
yaml的读写
"""
import yaml
# print(yaml.load(open("demo.yml"), Loader=yaml.FullLoader))
"""
yaml的读写
"""
import yaml
# print(yaml.load(open("demo.yml"), Loader=yaml.FullLoader))
python源文件处理
最新推荐文章于 2024-09-04 20:18:34 发布