Hi,

I am using Python 3.6 on Windows 7.

I have a file called apefile.txt. apefile.txt's contents are:

apes =  "Home sapiens", "Pan troglodytes", "Gorilla gorilla"

I have a script:

apefile =  open("apefile.txt")
apelist =  apefile.read()
for ape in apelist:
   print("one of the apes is " + ape)
apefile.close()


The output from the script does not print the ape names, instead it prints each letter in the file. For example:

one of the apes is a
one of the apes is p
one of the apes is e


What should I do instead to get something like

one of the apes is Home sapiens
one of the apes is Pan troglodytes
one of the apes is Gorilla gorilla



John
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to