Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import os
- tmp = list(os.walk(os.getcwd()))
- with open("walk.txt", "w") as file:
- nl = "\n" #can't use \n inside of an f-string :/
- for i in tmp:
- file.write(f"Folder: {i[0]}{nl}Subfolders: {', '.join(i[1])}{nl}Files: {nl}{nl.join(i[2])}\n\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement