1import csv
2import requests
3
4CSV_URL = 'http://samplecsvs.s3.amazonaws.com/Sacramentorealestatetransactions.csv'
5
6with requests.Session() as s:
7 download = s.get(CSV_URL)
8
9 decoded_content = download.content.decode('utf-8')
10
11 cr = csv.reader(decoded_content.splitlines(), delimiter=',')
12 my_list = list(cr)
13 for row in my_list:
14 print(row)
1import pandas as pd
2
3url = "http://samplecsvs.s3.amazonaws.com/SalesJan2009.csv"
4df = pd.read_csv(url)
5
6print(df.head())
7
1import requests
2from contextlib import closing
3import csv
4
5url = "http://samplecsvs.s3.amazonaws.com/SalesJan2009.csv"
6
7with closing(requests.get(url, stream=True)) as r:
8 f = (line.decode('utf-8') for line in r.iter_lines())
9 reader = csv.reader(f, delimiter=',', quotechar='"')
10 for row in reader:
11 print(row)
12
1import csv
2import urllib2
3
4url = 'http://winterolympicsmedals.com/medals.csv'
5response = urllib2.urlopen(url)
6cr = csv.reader(response)
7
8for row in cr:
9 print row