Answers for "python test file"

1

python check if file has content

>>> import os
>>> os.stat("file").st_size == 0
True
Posted by: Guest on March-26-2020
0

python check file format

# Assuming m is a string, you can use endswith:
if m.endswith('.mp3'):
...
elif m.endswith('.flac'):
...
Posted by: Guest on February-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language