Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson3-1-1_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
c34b5995
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
d4b8e555
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
1.py
1.py
View file @
c34b5995
# aaa=open(r"C:\Users\周\Desktop\123.txt","w",encoding='UTF-8')
# aaa=open(r"C:\Users\周\Desktop\123.txt","w",encoding='UTF-8')
#
aaa.write("小兰:12
")
#
aaa.write("小兰:12\n
")
#
aaa.write("小丽:11
")
#
aaa.write("小丽:11\n
")
#
aaa.write("李文:9
")
#
aaa.write("李文:9\n
")
#
aaa.write("张伟:16
")
#
aaa.write("张伟:16\n
")
# aaa.close()
# aaa.close()
with
open
(
r"C:\Users\周\Desktop\123.txt"
,
"a"
,
encoding
=
'UTF-8'
)
as
aaa
:
# with open (r"C:\Users\周\Desktop\123.txt","a",encoding='UTF-8') as aaa:
aaa
.
write
(
"小强:12"
)
# aaa.write("小强:12\n")
aaa
.
write
(
"李明:15"
)
# aaa.write("李明:15\n")
\ No newline at end of file
with
open
(
r"C:\Users\周\Desktop\123.txt"
,
"r"
,
encoding
=
'UTF-8'
)
as
bbb
:
for
q
in
bbb
:
if
"小强:10"
and
"xiaox"
in
bbb
:
print
(
"在其中"
)
else
:
print
(
"不在"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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