如何编写Python代码以进入文件并输出其’类型-大小’属性?

huangapple go评论78阅读模式
英文:

How do I write Python code that enters a file and outputs its 'type-size' properties?

问题

如何编写Python代码以输入一个文件'pdf,word,png...'并输出其'type-size'属性?

如何编写Python代码以输入一个文件并输出其'type-size'属性?

英文:

How do I write Python code that enters a file'pdf,word, png...' and outputs its 'type-size' properties ?

How do I write Python code that enters a file and outputs its 'type-size' properties

答案1

得分: 0

https://pypi.org/project/filetype/

For the size you can just use os.path.getsize()

英文:

For the type check this out:

https://pypi.org/project/filetype/

For the size you can just use os.path.getsize()

huangapple
  • 本文由 发表于 2023年3月31日 17:18:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/75896780.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定