国产成人AV无码一二三区,少女1到100集,国产精品久久久久精品综合紧,巜公妇之诱感肉欲HD在线播放

文章 > Python基础教程 > python如何生成tar文件内容

python如何生成tar文件内容

Python tar 文件

头像

爱喝马黛茶的安东尼

2019-09-23 17:20:166520浏览 · 0收藏 · 0评论

tarfile包中的.open(name, mode)方法能够以mode指定的方式打开name压缩文件,并返回一个TarFile类对象。调用TarFile对象的extractall(path)方法可以将tar文档解压到path指定的位置。

import tarfile
tar = tarfile.open( '*.tar.gz', mode = "r:gz") #"r:gz"表示 open for reading with gzip compression
tar.extractall(path='temp')  ### 将tar.gz文件解压到temp文件夹下
tar.close()

open返回的对象不但可以用来读文档数据('r': reading),还可以写('w': writing),附加('a': appending)。

相关推荐:《Python教程

如下是mode取值所对应的含义:

'r' or 'r:*' open for reading with transparent compression
'r:'         open for reading exclusively uncompressed
'r:gz'       open for reading with gzip compression
'r:bz2'      open for reading with bzip2 compression
'r:xz'       open for reading with lzma compression
'a' or 'a:'  open for appending, creating the file if necessary
'w' or 'w:'  open for writing without compression
'w:gz'       open for writing with gzip compression
'w:bz2'      open for writing with bzip2 compression
'w:xz'       open for writing with lzma compression
 
'x' or 'x:'  create a tarfile exclusively without compression, raise
             an exception if the file is already created
'x:gz'       create a gzip compressed tarfile, raise an exception
             if the file is already created
'x:bz2'      create a bzip2 compressed tarfile, raise an exception
             if the file is already created
'x:xz'       create an lzma compressed tarfile, raise an exception
             if the file is already created
 
'r|*'        open a stream of tar blocks with transparent compression
'r|'         open an uncompressed stream of tar blocks for reading
'r|gz'       open a gzip compressed stream of tar blocks
'r|bz2'      open a bzip2 compressed stream of tar blocks
'r|xz'       open an lzma compressed stream of tar blocks
'w|'         open an uncompressed stream for writing
'w|gz'       open a gzip compressed stream for writing
'w|bz2'      open a bzip2 compressed stream for writing
'w|xz'       open an lzma compressed stream for writing
关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

公交车上扒开腿做爰H漫画| 黑色蕾丝透视露胸旗袍连衣裙| 吻戏高潮| 俄罗斯姑娘免费看高清电视剧| 簧片在线观看| 爱咲れいら| 高压监狱2法国1时43分| 自己弄多了会变黑可以变白吗女生| 性别饥饿妈妈| 出轨的妻子| 麻豆| 《性呻吟》伦理| 兄妹客厅当父母面爱叫啥| 女儿借爸爸种生孩子| 光溜溜瑜伽全套视频大全| 第一章激情艳妇| 小奶球抖动舞蹈视频| AAA成人片爽久爽久爽| 家公给我治疗5中字| 水蜜桃免费观看电视剧最新章节| 第一章激情艳妇| GOOGLE CHROME| 老头握住淑蓉双乳| 暴躁少女CSGO高清大图特点| 交换第一次| 开会桌下把荫蒂添的好多水 | 老师含紧一点H边做边走| 中国记协| 麻花MV在线看免费观看电视剧| 出门忘穿胸置乳头凸起怎么办 | 太粗太大弄死我了L毛片| 第1章饱满的乳峰喷奶水动漫| 400入成品短视频| B级文件| 邻家阿姨完整版免费观看| 做一次爱下面多久才能恢复| 《女朋友的妹妹3》| 韩国禁欲系高级感电影| 小洞流口水了 是不是饿了 | 白带内裤拉丝尿液| 儿子耕种母亲的田地的收获