So I am making a program that takes a text file, breaks it into words, then writes the list to a new text file.
The issue I am having is I need the strings in the li
You cannot change how str works for list.
str
list
How about using JSON format which use " for strings.
"
>>> animals = ['dog','cat','fish'] >>> print(str(animals)) ['dog', 'cat', 'fish'] >>> import json >>> print(json.dumps(animals)) ["dog", "cat", "fish"]
import json ... textfile.write(json.dumps(words))