File and directory Paths - Python Cheatsheet

PHOTO EMBED

Sun Sep 24 2023 02:09:34 GMT+0000 (Coordinated Universal Time)

Saved by @OperationsBGSC #python

>>> my_files = ['accounts.txt', 'details.csv', 'invite.docx']

>>> for filename in my_files:
...     print(os.path.join('C:\\Users\\asweigart', filename))
...
# C:\Users\asweigart\accounts.txt
# C:\Users\asweigart\details.csv
# C:\Users\asweigart\invite.docx
content_copyCOPY

https://www.pythoncheatsheet.org/cheatsheet/file-directory-path