python read entire file
with open('Path/to/file', 'r') as content_file:
content = content_file.read()
python read entire file
with open('Path/to/file', 'r') as content_file:
content = content_file.read()
check if file is txt python
Assuming m is a string, you can use endswith:
if m.endswith('.mp3'):
...
elif m.endswith('.flac'):
...
To be case-insensitive, and to eliminate a potentially large else-if chain:
m.lower().endswith(('.png', '.jpg', '.jpeg'))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us