2017-11-01から1日間の記事一覧

【python】 proxy下でデータセットをダウンロードする

以下の設定を書く. import urllib.request # proxy の設定 proxy_support = urllib.request.ProxyHandler({'http' : 'http://***.***.***:port', 'https': 'https://***.***.***:port'}) opener = urllib.request.build_opener(proxy_support) urllib.reques…

【python】 日本語CSVの読み込み時のエンコーディング

encoding = "utf-8"と指定する必要がある with open(filename, "r", encoding = "utf-8") as f: reader = csv.reader(f) header = next(reader) for row in reader: print(row)