with open("games.txt", "w") as text_file:
print(driver.current_url)
text_file.write(driver.current_url + "\n")
I'm using this code right now, but when it writes to the file it overwrites the old content. How can I simply add to it without erasing the content that's already there.
Answer
Instead of "w"
use "a"
(append) mode with open
function:
with open("games.txt", "a") as text_file:
No comments:
Post a Comment