x99

Python中编码encode()与解码decode()

六眼飞鱼酱① 提交于 2020-01-06 18:36:49
1 print('这是编码'.encode('utf-8')) # 结果 b'\xe8\xbf\x99\xe6\x98\xaf\xe7\xbc\x96\xe7\xa0\x81' 2 print('这是编码'.encode('gbk')) # 结果 b'\xd5\xe2\xca\xc7\xb1\xe0\xc2\xeb' 3 4 print(b'\xe8\xbf\x99\xe6\x98\xaf\xe7\xbc\x96\xe7\xa0\x81'.decode('utf-8')) # 结果'这是编码' 5 print(b'\xd5\xe2\xca\xc7\xb1\xe0\xc2\xeb'.decode('gbk')) # 结果'这是解码' 来源: https://www.cnblogs.com/Through-Target/p/12147972.html

彻底解决tinker打包成exe后不能显示图片

99封情书 提交于 2019-11-30 06:16:02
核心方法 将PyQt5与tinker结合实现程序简化同时打包成exe后完全脱离依赖读取资源文件(只测试了图片) 实现 为了简单,我写了一个最简单的程序作为参考 为了直观,我将所有代码,运行后的截图,打包后的exe截图发出来 上次上传的文件竟然审核不过? 主函数a.py代码,(名字随便) import tkinter as tk class App: def __init__(self, root): tk.Label(background="white",text="测试").pack() separator0 = tk.Frame(height=10, bd=10) separator0.pack(padx=5, pady=5) self.hi_there = tk.Button(separator0, text="现在在tinker中,点击此处调用pyqt5", fg="black", background="white",command=self.start) self.hi_there.pack() def start(self): import sys from PyQt5.QtWidgets import QApplication, QWidget from PyQt5.QtGui import QIcon import b class Example(QWidget)