Commit b73da3aa by BellCodeEditor

auto save

parent 8f08dece
Showing with 10 additions and 4 deletions
import csv
a=[["姓名","性别","体育项目"],["小明","男","跳高"],["小兰","女","跑步"]]
with open("888.csv","w",encoding="utf-8",newline='')as file:
'''with open("888.csv","w",encoding="utf-8",newline='')as file:
f=csv.writer(file)
#f.writerow(["小明","男","跳高"])
f.writerows(a)
\ No newline at end of file
f.writerow(["小明","男","跳高"])
f.writerows(a)'''
with open("888.csv","r",encoding="utf-8",newline='')as file:
f=csv.reader(file)
data=list(f)
print(data[2][0])
\ No newline at end of file
小明,男,跳高
姓名,性别,体育项目
小明,男,跳高
小兰,女,跑步
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment