python - Printing utf-8 in windows cmd -
python - Printing utf-8 in windows cmd -
i building battleships game in python , printing function (the user can print board) includes utf-8 character borders.
the file:
# -*- coding: utf-8 -*- __future__ import print_function import random import numpy import ascii_art row_len = 10 def print_board(board): print (ascii_art.game_on + '\n', end="") in range(0, row_len - 1): print (' _______', end="") print(' _______ \n', end="") x in range(0, row_len): y in range(0, row_len): print ('│ ', end="") if board[x][y] != 'e': print (board[x][y], end="") else: print (' ', end="") print(' ', end="") print('│\n', end="") j in range(0, row_len - 1): print(' ¯¯¯¯¯¯¯', end="") print(' ¯¯¯¯¯¯¯ \n', end="") homecoming 0 curr_board = construct_board() # constructs board numpy array player.print_board(curr_board.tolist())
however, every time use
import codecs codecs.register(lambda name: codecs.lookup('utf-8') if name == 'cp65001' else none)
i gibberish on cmd. how can solve that?
python utf-8 python-2.6
Comments
Post a Comment