python《信息安全专业导论》期末考试内容(三)

 1 f = open("20201212.txt", "w")
 2 f.write ("20201212")
 3 
 4 f=open("20201212.txt","r")
 5 print(f.read())
 6 f.close()
 7 
 8 f=open("20201212.txt","r")
 9 n=f.read()
10 a=0
11 for i in n:
12     a=a+int(i)
13 print(a)
14 b=bin(a)
15 print(b)
16 f=open("20201212b.txt","w")
17 f.write(b)
18 f.close()

 

posted @ 2021-01-04 20:52  油菜园12号  阅读(70)  评论(0编辑  收藏  举报