Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

bellcode / lesson12-1

  • This project
    • Loading...
  • Sign in
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
Switch branch/tag
  • lesson12-1
  • diy.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    auto save · 6e677d11
    BellCodeEditor committed a year ago
    6e677d11
diy.py 875 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# sb=open(r"C:\Users\Administrator\Desktop\新建文本文档.txt","w",encoding="utf-8")
# sb.write("一giao我里giao\n")
# sb.close()
# sb=open(r"C:\Users\Administrator\Desktop\新建文本文档.txt","a",encoding="utf-8")
# sb.write("一giao我里giao\n")
# sb.close()
abab=""
with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt","a",encoding="utf-8") as sb:
     sb.write("一gan我里gan\n")
with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt","r",encoding="utf-8") as sb:
    for data in sb:
        if "一gan我里gan\n" in data:
            data.replace("gan","gauauau")
        abab+=data   
with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt","w",encoding="utf-8") as sb:
    sb.write(abab)
with open(r"C:\Users\Administrator\Desktop\新建文本文档.txt","r",encoding="utf-8") as sb:
    a=sb.read()
    print(a)