Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-5_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
6fb0524b
authored
Apr 10, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
ac8009c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
15 deletions
爱心.py/第八题.py
爱心.py/第四题.py
玩儿.py
爱心.py/第八题.py
View file @
6fb0524b
a
=
int
(
input
(
"请输入确诊数A:"
))
a
=
int
(
input
(
"请输入一个三位数: "
))
a
=
int
(
input
(
"请输入确诊数A:"
))
a
=
int
(
input
(
"请输入一个三位数: "
))
b
=
int
(
input
(
"请输入死亡数B:"
))
b
=
a
%
10
c
=
int
((
a
/
10
)
%
10
)
d
=
int
((
a
/
100
)
%
10
)
print
(
b
,
c
,
d
)
print
(
"
%0.3%
"
)
filel
=
open
(
r"C:\Users\lenovo\Desktop\wzm.txt"
,
'w'
,
encoding
=
'utf-8'
)
\ No newline at end of file
filel
.
write
(
str
(
b
)
+
str
(
c
)
+
str
(
d
))
filel
.
close
()
\ No newline at end of file
爱心.py/第四题.py
View file @
6fb0524b
-- "a/\347\210\261\345\277\203.py/\347\254\254\345\233\233\351\242\230.py"
def
new_input
():
def
new_input
():
a
=
[]
while
True
:
b
=
input
(
"请输入数字:"
)
\ No newline at end of file
玩儿.py
View file @
6fb0524b
filel
=
open
(
r"C:\Users\lenovo\Desktop\xxxx.txt"
,
'a'
,
encoding
=
'utf-8'
)
new_date
=
''
filel
=
open
(
r"C:\Users\lenovo\Desktop\xxxx.txt"
,
'a'
,
encoding
=
'utf-8'
)
new_date
=
''
filel
=
open
(
r"C:\Users\lenovo\Desktop\xxxx.txt"
,
'w'
,
encoding
=
'utf-8'
)
filel
.
write
(
'小强:10本
\n
'
)
filel
.
write
(
'李明:15本
\n
'
)
filel
.
write
(
'小兰:12本
\n
'
)
filel
.
write
(
'小兰:12本
\n
'
)
filel
.
write
(
'随机:12本
\n
'
)
for
date
in
filel
:
filel
.
write
(
'小明:11本
\n
'
)
if
'小强:10本'
in
a
:
filel
.
close
()
date
=
date
.
replace
(
'小强:10本'
,
'小强:11本'
)
\ No newline at end of file
print
(
"在文件中"
)
filel
.
close
()
#with open(r"C:\Users\lenovo\Desktop\xxxx.txt",'a',encoding='utf-8') as file:
#file.write('小兰:12本\n')
#with open(r"C:\Users\lenovo\Desktop\xxxx.txt",'r',encoding='utf-8') as file:
#print( file.read())
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