新建一个本地文件,并写入内容 python

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Zzhouzhou237/article/details/82965485
import os

def test():
    if not os.path.exists('./log') :
        os.mkdir('./log')
    savingtxtmsg = open('./log/autotlog.txt', 'a')
    savingtxtmsg.write("hh")
    savingtxtmsg.write('\n')
    savingtxtmsg.close()


if __name__ == '__main__':
    test()

猜你喜欢

转载自blog.csdn.net/Zzhouzhou237/article/details/82965485
今日推荐