python excel处理
#!/usr/bin/python
# data:2018/4/20
# user:fei
# -*- coding: utf-8 -*-
import json
import sys
import time
import openpyxl
import json creat_data=time.strftime('%Y-%m-%d',time.localtime())
i=1
wb = openpyxl.Workbook()
sheet = wb.active
sheet.title = (creat_data + '-people')
field = ['类型', '姓名', '用户名', '单位', '职务', '科室']
for title in field: # 写入表头
sheet.cell(row=1, column=i, value=title)
i += 1 with open('C:/Users/fei/PycharmProjects/git_data/python_base/day10/json','r+',encoding='utf8') as f:
load_dict = json.load(f)
for line in load_dict:
info=line['data']
basic_info=info['basic']
job_info=info['job']
user_type=info['account_type']
username=basic_info['real_name']
user_id=basic_info['username']
organization=job_info['organization']
position=job_info['position'][0]
department=job_info['department']
all_info=[user_type,username,user_id,organization,position,department]
# print(all_info)
sheet.append(all_info)
wb.save('test.xlsx')
print('打印完成')
python excel处理的更多相关文章
- Python excel 库:Openpyxl xlrd 对比 介绍
打算用python做一个写mtk camera driver的自动化工具. 模板选用标准库里面string -> Template 即可 但要重定义替换字符,稍后说明 配置文件纠结几天:cfg, ...
- python excel操作总结
1.openpyxl包的导入 Dos命令行输入 pip install openpyxl==2.3.3 这里注意一下openpyxl包的版本问题 版本装的太高有很多api不支持了,所以笔者这里用的是2 ...
- Python Excel 多sheet 多条数据 自定义写入
pip install xlwt python excel 数据写入操作,处理网站数据导出以及不是太多数据的爬虫存储, 用处蛮多的轮子. (150+++++++++++++++++++++++++++ ...
- xlrd python excel
xlrd python excel
- [Python]Excel编程示例教程(openpyxl)
1 前言(Preface) 博文背景:论文实验中有一大堆数据集需要观测其数据特征,通过人体肉眼,难以直观感受,故而准备通过生成Excel,可视化其评测数据. We know: Excel便于可视化分析 ...
- Python生成文本格式的excel\xlwt生成文本格式的excel\Python设置excel单元格格式为文本\Python excel xlwt 文本格式
Python生成文本格式的excel\xlwt生成文本格式的excel\Python设置excel单元格格式为文本\Python excel xlwt 文本格式 解决: xlwt 中设置单元格样式主要 ...
- python excel单元格及样式
python excel单元格及样式: #!/usr/bin/env python # -*- coding: utf-8 -*-” #只对当前文件的中文编码有效 # Filename : Write ...
- python excel操作
python操作excel表格(xlrd/xlwt)转载:http://www.cnblogs.com/zhoujie/p/python18.html 最近遇到一个情景,就是定期生成并发送服务器使 ...
- python excel 读写
python操作Excel读写--使用xlrd xlwt python中使用xlrd.xlwt操作excel表格详解
- python excel 像 Excel 一样使用 python 进行数据分析
https://www.jb51.net/article/63216.htm 像 Excel 一样使用 python 进行数据分析 : https://www.cnblogs.com/nxld/p/ ...
随机推荐
- mybatis mysql 批量insert 返回主键
Mybatis在插入单条数据的时候有两种方式返回自增主键: mybatis3.3.1支持批量插入后返回主键ID, 首先对于支持自增主键的数据库:useGenerateKeys和keyProper ...
- [Android]RecyclerView添加HeaderView出现宽度问题
通过getItemViewType方式判断HeaderView方式添加HeaderView的,结果发现有几个界面HeaderView宽度不能满屏. 于是对比了几种布局,发现LinearLayout为根 ...
- go grpc
https://godoc.org/google.golang.org/grpc go get google.golang.org/grpc go get -a github.com/golang/p ...
- AddComponentMenu
[AddComponentMenu] The AddComponentMenu attribute allows you to place a script anywhere in the " ...
- 【BZOJ3238】差异【后缀自动机+dp】
题意 分析 这个题目还是很优秀的.sigma(len(Ti)+len(Tj))的值是一定的=n*(n+1)*(n-1)/2.那么关键就是求任意两个后缀的lcp的和了. 我们怎么求两个后缀的lcp?如果 ...
- 启动日志中就出现[java:comp/env/spring.liveBeansView.mbeanDomain] not found这个日志
今天在做一个dubbo服务端的时候,启动成功,dubbo也注册成功,但是启动日志中就出现[java:comp/env/spring.liveBeansView.mbeanDomain] not fou ...
- 381. Insert Delete GetRandom O(1) - Duplicates allowed允许重复的设计1数据结构
[抄题]: Design a data structure that supports all following operations in average O(1) time. Note: Dup ...
- 695. Max Area of Island最大岛屿面积
[抄题]: 求最多的联通的1的数量 Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (repre ...
- Mule ESB 安装基本配置要求
Hardware Requirements* 2GHz, dual-core CPU, or 2 virtual CPUs in virtualized environments 2GB of RAM ...
- tftp-hpa客户端使用说明
1.板子 sudo apt-get install tftp-hpa 2.主机chmod 777 tftp—dir 3.tftp -4 192.168.1.122 -c put lib2.tar.gz ...