Created
March 6, 2020 09:02
-
-
Save ochilab/baf7e7e291e42e67a76061f9d3a04ff4 to your computer and use it in GitHub Desktop.
Python: CSVデータのファイル書き読み処理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
#読み込み | |
with open('sample.csv') as f: | |
#リストとして読み込み | |
csvdata = csv.reader(f, delimiter=',') #delimterの指定はなくてもよい | |
for row in csvdata: | |
print(row) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
data = [111,222,333] | |
with open('sample.csv', 'w',newline='') as f: | |
writer = csv.writer(f) | |
writer.writerow(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment