Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Printing to Text File

$
0
0
so, I got my script ready and I am trying to print out to a text file:

when I do a Print animal at the end of the code I get:

CATS
DOGS
APPLES
ORANGES

Then I tried

file = open('file.txt','w')
file.write(animal)

I get just CATS in the text file

Any ideas ?

Viewing all articles
Browse latest Browse all 2485

Trending Articles