Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson12-1
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
81aa8207
authored
Sep 22, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
41e03761
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
o.py
o.py
View file @
81aa8207
li
=
[
'小'
,
'虎'
,
'语'
]
file
=
open
(
'C:
\\
Users
\\
29018
\\
Desktop
\\
test.txt'
,
'a'
,
encoding
=
'utf-8'
)
file
.
writelines
(
li
)
\ No newline at end of file
file
=
open
(
'C:
\\
Users
\\
29018
\\
Desktop
\\
test.txt'
,
'w'
,
encoding
=
'utf-8'
)
file
.
write
(
"d"
)
file
.
close
()
file
=
open
(
'C:
\\
Users
\\
29018
\\
Desktop
\\
test.txt'
,
'r'
,
encoding
=
'utf-8'
)
'''for i in file:
if "d" in i:
print("在文件里")'''
lanzi
=
""
for
i
in
file
:
if
"d"
in
i
:
xin
=
i
.
replace
(
"d"
,
"o"
)
lanzi
=
lanzi
+
xin
file
=
open
(
'C:
\\
Users
\\
29018
\\
Desktop
\\
test.txt'
,
'w'
,
encoding
=
'utf-8'
)
file
.
write
(
lanzi
)
print
(
lanzi
)
file
.
close
()
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