Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
master
master
Branches (1)
master
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
master
main.py 1.95 KB
Copy Edit Raw Blame History
linght authored 2025年06月25日 22:18 +08:00 . 测试代码.
# main.py
import sys
from PySide6.QtWidgets import QApplication
from PySide6.QtCore import QByteArray
from compareYamlFile.compareYamlFile import CompareYamlFile
from commonLib.udpComm.udpComm import UdpComm
from commonLib.jsonHelper.jsonHelper import JsonHelper
def handle_received(data: QByteArray, host, port):
text = data.data().decode("utf-8", errors="ignore")
print(f"[主程序回调] 接收到数据: {text} 来自 {host.toString()}:{port}")
def test_json():
data = {
"name": "绅纺西",
"port": 12345,
"list": [1, 2, 3],
"nested": {"a": 10, "b": True}
}
# 编码为字符串
json_str = JsonHelper.encode(data)
print("编码后JSON字符串:")
print(json_str)
# 解析回对象
parsed = JsonHelper.decode(json_str)
print("解析后Python对象:")
print(parsed)
# 写入文件
JsonHelper.write_file(data, "test.json")
# 从文件读取
read_back = JsonHelper.read_file("test.json")
print("从文件读回的内容:")
print(read_back)
def main():
test_json();
udp = UdpComm();
udp.bind();
udp.dataReceived.connect(handle_received)
udp.send_data(b"Hello from main.py", "127.0.0.1", 12345)
comparer = CompareYamlFile()
file1 = "./cfg/config.yaml" # 你第一个yaml文件路径
file2 = "./cfg/config1.yaml" # 你第二个yaml文件路径
try:
diffs = comparer.compare_files(file1, file2)
if diffs:
print("发现差异项:")
for key, val in diffs.items():
print(f"{key}:")
print(f" file1 = {val['file1']}")
print(f" file2 = {val['file2']}")
else:
print("两个文件内容完全一致。")
except Exception as e:
print(f"比较时发生错误: {e}")
if __name__ == "__main__":
app = QApplication(sys.argv)
main()
sys.exit(app.exec())
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

pythonCode
No labels
GPL-3.0
Use GPL-3.0
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/linght/python-code.git
git@gitee.com:linght/python-code.git
linght
python-code
pythonCode
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /