文件操作,列表实例NiceHexSpiral
fr = open('jay.txt',mode='r',encoding='utf-8') jay = fr.read() print('明文:'+jay) print('密文:',end='') fr.close() fw = open('hannah.txt',mode='a',encoding='utf-8') for c in jay: print(chr(ord(c)+3),end='') fw.close()
import turtle turtle.speed(10) colors = ['#B0E2FF','blue','yellow','pink','green','orange'] for i in range(200): turtle.pencolor(colors[i%6]) turtle.forward(i) turtle.left(59) turtle.done()