repl.it
@hufeigopython/

basic_python_hw14

Python

寫入檔案

fork
loading
Files
  • main.py
  • demo.txt
main.py
1
2
3
4
5
with open('./demo.txt', 'a+') as fo:
    fo.write(input('輸入字串:'))
    for item in fo.readlines():
        print(item)