• open()
    • read()
    • readline()
    • seek()
    • write()
    • close()
    1. # 默认只读
    2. file = open('name.txt', 'w')
    3. file.write('abc')
    4. file.close()
    5. file2 = open('name.txt')
    6. data = file2.read()
    7. print(data)
    8. file2.close()
    9. file3 = open('name.txt', 'a')
    10. file3.write('def')
    11. file3.close()