Files
python/pythonProject/基础/fp.py
T
2025-12-02 23:17:47 +08:00

19 lines
179 B
Python

# w 表示写权限,文件不存在会自动创建
fp=open('hehe.txt', 'w')
a='''
1
2
3
4
5
6
7
8
9
10
11
12
'''
# file=fp 将打开的文件赋给fp
print(a,file=fp)
fp.close()