[Tutor] Syntax error and EOL Error
Nym City
nymcity at yahoo.com
Fri Sep 4 03:27:59 CEST 2015
Hello,
I am working with a csv file that has following sample data:
Rank URL Linking Root Domains
1 facebook.com/ 9616487
2 twitter.com/ 6454936
3 google.com/ 5868081
4 youtube.com/ 5442206
5 wordpress.org/ 4051288
In my program, I am reading in this csv file, taking only data from the second column and striping off the leading "/"
import csv
DomainList = []
domains = open('domainlist.csv', 'r')
DomainList = csv.reader(domains)
DomainList = [column[1] for column in DomainList]
DomainList = (str(DomainList).rstrip('/')
print('\n'.join(DomainList))
I keep getting EOL error on the second the last line and syntax error on the last print line. Even when I change the print line to say the following:
print(DomainList)
Please advise. Thank you in advance.
Thank you.
More information about the Tutor
mailing list