Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson23-diy1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
599ea45f
authored
Jul 11, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
c87fd676
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
11 deletions
my_csv.py
score1.csv
score2.csv
日19.py
my_csv.py
View file @
599ea45f
...
...
@@ -16,7 +16,9 @@ with open('score2.csv','w',encoding='utf-8')as f:
#多行写入
b
=
[[
4
,
5
,
6
,
7
,
8
],[
9
,
10
,
11
,
12
,
13
],[
14
,
15
,
16
,
17
,
18
,
19
]]
a
=
[
4
,
5
,
6
,
7
,
8
]
c
=
[
9
,
10
,
11
,
12
,
13
]
d
=
[
14
,
15
,
16
,
17
,
18
,
19
]
with
open
(
'score3.csv'
,
'w'
,
encoding
=
'utf-8'
,
newline
=
''
)
as
f
:
w
=
csv
.
writer
(
f
)
#创建读写对象
w
.
writerows
(
b
)
#把列表数据加入到文件中
...
...
score1.csv
View file @
599ea45f
姓名,语文,数学,英语,地理,历史,政治,生物,化学,物理
小贝,99,100,94,90,88,89,96,98,96
李强,86,95,96,84,86,63,78,66,74
小依,75,88,94,54,77,97,86,77,89
聪聪,65,76,97,66,73,78,58,66,69
波奇,74,67,61,72,66,81,75,79,80
九尾,88,85,80,78,74,90,81,69,70
皮皮,77,87,83,69,90,79,71,74,69
\ No newline at end of file
4,5,6,7,8
9,10,11,12,13
14,15,16,17,18,19
...
...
score2.csv
View file @
599ea45f
1,2,3,4
姓名,语文,数学,英语,地理,历史,政治,生物,化学,物理
小贝,99,100,94,90,88,89,96,98,96
李强,86,95,96,84,86,63,78,66,74
小依,75,88,94,54,77,97,86,77,89
聪聪,65,76,97,66,73,78,58,66,69
波奇,74,67,61,72,66,81,75,79,80
九尾,88,85,80,78,74,90,81,69,70
皮皮,77,87,83,69,90,79,71,74,69
\ No newline at end of file
日19.py
0 → 100644
View file @
599ea45f
import
csv
import
csv
# a=[4,5,6,7,8]
# c=[9,10,11,12,13]
# d=[14,15,16,17,18,19]
# with open('score1.csv','w',encoding='utf-8')as file:
# w=csv.writer(file)
# w.writerow(a)
# w.writerow(c)
# w.writerow(d)
# a=[[4,5,6,7,8],[9,10,11,12,13],[14,15,16,17,18,19,22]]
# with open('score2.csv','w',newline='',encoding='utf-8')as f:
# w=csv.writer(f)
# w.writerows(a)
with
open
(
'score2.csv'
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
r
=
csv
.
reader
(
f
)
r
=
list
(
r
)
#
pipi
=
r
[
7
]
print
(
'皮皮的成绩是:'
,
pipi
)
for
q
in
r
:
print
(
q
[
3
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment