Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson12-2
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
68f7c336
authored
Jul 17, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
81f5f5f9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6397 additions
and
16 deletions
1.py
dhahd.py
diy.py
nwcssb
renyuanxinxi.py
txt.py
1.py
0 → 100644
View file @
68f7c336
Changes suppressed. Click to show.
dhahd.py
View file @
68f7c336
new_date
=
""
with
open
(
r'C:\Users\Administrator\Desktop\test.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
filel
:
for
data
in
filel
:
if
'小强:10'
in
data
:
data
=
data
.
replace
(
"小强:10"
,
"小明12"
)
new_date
+=
data
print
(
new_date
)
chengji
=
input
()
ls
=
[]
a
=
0
ls
.
append
(
chengji
.
split
())
while
chengji
:
chengji
=
input
()
ls
.
append
(
chengji
.
split
())
diy.py
deleted
100644 → 0
View file @
81f5f5f9
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
with
open
(
r'C:\Users\Administfilelrator\Desktop\test.txt'
,
'a'
,
encoding
=
'utf-8'
)
as
filel
:
filel
.
write
(
"小强:10本"
)
filel
.
write
(
"小明:24"
)
nwcssb
0 → 100644
View file @
68f7c336
renyuanxinxi.py
0 → 100644
View file @
68f7c336
chengji
=
input
()
ls
=
[]
a
=
0
ls
.
append
(
chengji
.
split
())
while
chengji
:
chengji
=
input
()
ls
.
append
(
chengji
.
split
())
ls
.
pop
(
-
1
)
for
i
in
ls
:
a
=
a
+
int
(
i
[
1
])
a
=
a
/
len
(
ls
)
b
=
{}
for
i
in
ls
:
b
[
i
[
0
]]
=
i
[
1
]
ls1
=
list
(
b
.
items
())
ls1
.
sort
(
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
print
(
"分数最高的学科是{}:{}分数最低的学科是{}:{}平均分是:{:.2f}"
.
format
(
ls1
[
0
][
0
],
ls1
[
0
][
1
],
ls1
[
-
1
][
0
],
ls1
[
-
1
][
1
],
a
))
txt.py
0 → 100644
View file @
68f7c336
with
open
(
r"C:\Users\Administrator\Desktop\sales_list.txt"
,
"w"
,
encoding
=
"utf-8"
)
as
spas
:
spas
.
write
(
"小明"
)
\ No newline at end of file
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