python打印love图

  • A+
所属分类:BLOG Program Python

分享两段代码: 打印love图:

print('\n'.join([''.join([(u'I@Love@You爱'[(x-y)%11]if((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3<=0 else' ')for x in range(-30,30)])for y in range(15,-15,-1)]))

打印一箭穿心图:

print('\n'.join([''.join(['*'if abs((lambda a: lambda z, c, n: a(a, z, c, n))(lambda s, z, c, n: z if n == 0 else s(s, z*z+c, c, n-1))(0, 0.02*x+0.05j*y, 40)) < 2 else ' ' for x in range(-80, 20)]) for y in range(-20, 20)]))

另外可以将python代码编译生成二进制执行文件:

  • 安装PyInstaller pip install PyInstaller
  • 编译
    # Linux系统
    pyinstall -F python_code_name.py
    #Windows系统
    pyinstaller.exe -F python_code_name.py

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: