|
|
# -*- encoding: utf-8 -*-
|
|
|
"""
|
|
|
@File : test.py
|
|
|
@License : (C)Copyright 2021-2023
|
|
|
|
|
|
@Modify Time @Author @Version @Description
|
|
|
------------ ------- -------- -----------
|
|
|
2023/10/7 11:20 zart20 1.0 None
|
|
|
"""
|
|
|
char = "A"
|
|
|
|
|
|
hex_value = hex(ord(char))
|
|
|
|
|
|
print(f"The hexadecimal value of '{char}' is {hex_value}")
|
|
|
|
|
|
def char_to_hex(st):
|
|
|
hex_value = hex(ord(st))
|
|
|
print(f"The hexadecimal value of '{st}' is {hex_value}")
|
|
|
|
|
|
def hex_to_char(hex):
|
|
|
char = chr(int(hex, 16))
|
|
|
print(f"The character represented by '{hex}' is '{char}'")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
真实磁盘的读写,以标称64GB的U盘为例,查看磁盘记录信息的工具是WinHex
|
|
|
将一块64GB的U盘接入电脑,为了方便查看结果,先将用磁盘工具如DiskGenius将U盘格式化,
|
|
|
注意格式化时文件系统选择FAT32,簇大小选择64KB
|
|
|
此时用管理员权限打开WinHex
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
import pandas as pd
|
|
|
|
|
|
# 创建一个空的DataFrame
|
|
|
df = pd.DataFrame(columns=["Name", "Age"])
|
|
|
|
|
|
# 创建一个字典
|
|
|
new_data = {"Name": "John", "Age": 30}
|
|
|
|
|
|
# 使用append方法将字典添加到DataFrame中
|
|
|
df = df.add
|
|
|
|
|
|
# 打印DataFrame
|
|
|
print(df)
|
|
|
|
|
|
|
|
|
import tkinter as tk
|
|
|
import tkinter.font as tkFont
|
|
|
|
|
|
def open_file():
|
|
|
# 在这里添加打开文件的功能
|
|
|
pass
|
|
|
|
|
|
def save_file():
|
|
|
# 在这里添加保存文件的功能
|
|
|
pass
|
|
|
|
|
|
def exit_app():
|
|
|
root.quit()
|
|
|
|
|
|
root = tk.Tk()
|
|
|
root.title("菜单栏字体大小示例")
|
|
|
|
|
|
# 创建自定义字体
|
|
|
custom_font = tkFont.Font(family="Helvetica", size=16) # 修改字体和大小
|
|
|
|
|
|
# 创建菜单栏
|
|
|
menubar = tk.Menu(root, font=custom_font)
|
|
|
root.config(menu=menubar)
|
|
|
|
|
|
# 创建文件菜单
|
|
|
file_menu = tk.Menu(menubar, tearoff=0, font=custom_font)
|
|
|
menubar.add_cascade(label="文件", menu=file_menu)
|
|
|
|
|
|
# 在文件菜单中添加选项
|
|
|
file_menu.add_command(label="打开", command=open_file)
|
|
|
file_menu.add_command(label="保存", command=save_file)
|
|
|
file_menu.add_separator()
|
|
|
file_menu.add_command(label="退出", command=exit_app)
|
|
|
|
|
|
# 运行主循环
|
|
|
root.mainloop()
|