[Tutor] Loop not iterating

Nym City nymcity at yahoo.com
Sun Jun 28 21:32:40 CEST 2015


Hello,
I am working on my second program and its a two part progam that I want to design However, i am not sure what silly mistake I am making on the first part:
Here is my code:

| 2
3
4
5
6
7 | import csv
domains = open('top500domains.csv')
domainsReader = csv.reader(domains)
domainLists = list(domainsReader)
for domain in domainLists:
     something = ("www." + str(domain))
print(something)

 |

My program reads in a CSV file that has 500 list of domains. However, when I save the output of my loop to the variable name "something" - and later print "something" it contains only 1 entry from my csv file.
On the other hand, instead of saving of loop output to the variable "something" - if I just print, I get all 500 entries displayed.
Please advise. Thanks!

https://bpaste.net/show/3664abce17b7


   Thank you.


More information about the Tutor mailing list