python 读写文件
#! -*- encoding:utf-8 -*- import os from config import * from function import GetCsspToken, RegistInCssp, GetCsspStatus if __name__=='__main__': token = GetCsspToken(email, mypasswd) if os.path.isfile("./status.txt"): os.remove("./status.txt") fp = open("./status.txt","w") statuses = GetCsspStatus(token) i = 0 for status in statuses: i = i + 1 print("%5d %20s %15s %15s %16s %30s %8s"%(i, status['hostName'],status['primaryIp'],status['securityStatus'],status['status'],status['systemOwnerEmail'],status['id'])) fp.writelines(["%5d %20s %15s %15s %16s %30s %8s"%(i, status['hostName'],status['primaryIp'],status['securityStatus'],status['status'],status['systemOwnerEmail'],status['id'])]) fp.write('\n') fp.close()
收获不会与付出成反比
by juandx