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

Question:

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

Asked By: MANEL AMROUCHE

||

Answers:

For the type check this out:

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

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

Answered By: Miguel Gonzalez
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.