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

Administrator / lesson4_5

  • 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
  • lesson4_5
  • diy2.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    save project · b099a238
    BellCodeEditor committed 2 years ago
    b099a238
diy2.py 417 Bytes
1 2 3 4 5 6 7 8 9
with open(r"C:\Users\Administrator\Desktop\book.txt",'r',encoding='utf-8') as file:
    for data in file:
        if '小兰:12本' in data:
            print('小兰数据在文件中')
with open(r"C:\Users\Administrator\Desktop\book.txt",'w',encoding='utf-8') as file:
    file.write(new_data)   
with open(r"C:\Users\Administrator\Desktop\book.txt",'r',encoding='utf-8') as file:
    a = file.read()
    print(a)