1.如果你看到诸如pygame.error:
font not initialized的一个错误,检查看看是否在程序的开始处忘记调用pygame.init()了。
2.加载pygame找照片或其他文件,出现以下错误
self.image = pygame.image.load('images/贝吉塔.bmp')
FileNotFoundError: No such file or directory.
在文件已在目录情况下,请尝试将源路径加入,如
self.image = pygame.image.load(r'D:\pycharm\daimafile\alien_invasion\images\贝吉塔.bmp')
3.说明需要.encode(‘utf-8’) 如:request.urlencode(data).encode(‘utf-8’)
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str.
4.出现如下
b’{“status”:false,“msg”:"\xe6\x82\xa8\xe6\x93\x8d\xe4\xbd\x9c\xe5\xa4\xaa\xe9\xa2\x91\xe7\xb9\x81,\xe8\xaf\xb7\xe7\xa8\x8d\xe5\x90\x8e\xe5\x86\x8d\xe8\xae\xbf\xe9\x97\xae",“clientIp”:“218.87.100.10”,“state”:2402}\n’
则:
print(resp.read().decode('utf-8')) #解码成utf-8