想实现用python列表功能来洗牌的程序,在网上查到黑桃、梅花、方块、红桃的对应字符分别是"u2660", “u2663”, “u2665”, “u2666”
但是在遍历列表打印花色的时候出现了问题:
“Traceback (most recent call last):
File “D:dachuangbgpython exerciseliebiaolianxianlixipai.py”, line 6, in
print(types)
UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘u2660’ in position 2: illegal multibyte sequence”
代码如下:
cards = [card for card in range(52)]
types = ["u2660", “u2663”, “u2665”, “u2666”]
print(types)
有无大佬帮忙解决?