如何在终端中打印方块?

时间:2018-05-25 13:18:41

标签: python-3.x unicode fonts

我想组合一个QR码,所以我找到了unicode' / u2588'它应该是一个方形的黑色块,但是在终端。

无法正确显示,该块变为矩形:

enter image description here

所以,我需要逃避字体?或..

我的字体现在:Dejavu Sans Mono 代码:python3

源代码:

def print_cmd_qr(qrText, white=u'/u2588', black='  ', enableCmdQR=True):
    blockCount = int(enableCmdQR)
    if abs(blockCount) == 0:
       blockCount = 1
       white *= abs(blockCount)
          if blockCount < 0:
             white, black = black, white
             sys.stdout.write(' '*50 + '\r')
             sys.stdout.flush()
             qr = qrText.replace('0', white).replace('1', black)
             sys.stdout.write(qr)
             sys.stdout.flush()

0 个答案:

没有答案
相关问题