In Python, is it possible to add custom property/metadata to a file? For example, I need to add "FileInfo" as a new property of the file. I need a method that works on various file formats
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
The easy way to do this is to simply add your new attribute to the file object instance. Eg,
output
Alternatively, create your own file object by deriving from one of the classes defined in the
io
module.