I'm looking to print the names of the folders/files of my current working directory to a txt file. This is what I have:
import os output_file = open('names.txt' , 'w') output_file.write(os.listdir(os.getcwd())) output_file.close()
Now I know the error lies in the output_file.write function because it is expecting character or string as opposed to what I put. I'm not sure how else to write it though.