没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
3页
openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files. It was born from lack of existing library to read/write natively from Python the Office Open XML format. All kudos to the PHPExcel team as openpyxl was initially based on PHPExcel. Security By default openpyxl does not guard against quadratic blowup or billion laughs xml attacks. To guard against these attacks install defusedxml.
资源推荐
资源详情
资源评论
i mport xl w t
写入内容:
d ef e g 0 0 ( ) :
' ' ' 创 建 工 作 簿 & 表 写入数据 保 存 文 件
' ' '
# 创 建 工 作 簿 ( w o r k b oo k ) , 添 加 工 作 表 ( w or k s h e e t )
wb = x l w t .W o r k b o o k ( )
ws = w b . a dd _ s h e e t ( ' my s h e e t ')
# 写 入
f o r i i n r a n g e ( 56 ) :
w s . w ri t e ( i, 0, s t r ( i ))
w s . wr i t e ( i , 2 , ' C o n t e n t' )
# 保 存
f i l e n a m e = ' r e s ul t 0 . x l s '
wb . s ave ( f i le n a m e )
p r i n t ( " Do n e ! "
背景色
style pattern
d ef e g 0 1 ( ) :
' ' '
创 建 工 作 簿 、 表
定 义 单 元 格 p a tt e r n 属 性
写 入 , 保 存
' ' '
# 创 建 工 作 簿 ( w o r k b oo k ) , 添 加 工 作 表 ( w or k s h e e t )
w b = x l wt . W o r k b oo k ( )
w s = w b .a d d _ s h e et ( ' m y s h e e t' )
p r i n t ( " Cr e a t e d wo r k b o o k a n d 'm y s h ee t ' " )
# 根 据 属 性 写入 写数 据
p r i n t ( " wr i t i n g wi t h s o m e s ty l e . . . " )
f o r i i n r a n g e ( 56 ) :
# 创 建 p a t te r n 单 元 格
p a t t e rn = x l w t . P a t te rn() # C r e a t e t h e p at t e r n
# p a t t e r n 属性 : 填 充
p a t t er n . p a t t e r n = x lwt. P a t t e rn.SOL I D _ P A TTER N # M a y b e : N O _ PA TTER N , S O LID_PA T T E R N ,
o r 0x 0 0 t h r ou g h 0 x 1 2
资源评论
losacii
- 粉丝: 192
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功