如果没有PIL库,则使用命令行安装
python2安装:pip install PIL
python3安装:pip install pillow
from PIL import Image
#字符集:用作字符画的颜色构成
ascii_char = list("$B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft|()1{}[]?-_+~i!lI;:,.^`/ ")
# get_char函数:将256灰度映射到68个字符上,因为键盘字符集一共有68个
def get_ch