viligen

file_handling

Feb 2nd, 2022
738
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. import os
  2. dir_name = os.path.dirname(os.path.abspath(__file__))
  3. path = os.path.join(dir_name, "temp_test", "text.txt")
  4. print(path)
  5. try:
  6.     os.remove(path)
  7. except FileNotFoundError:
  8.     print('File already deleted!')
  9.  
Advertisement
Add Comment
Please, Sign In to add comment