使用Python創(chuàng)建一個(gè)功能完整的Windows風(fēng)格計(jì)算器程序
Python實(shí)現(xiàn)Windows系統(tǒng)計(jì)算器程序(含高級(jí)功能)
下面我將介紹如何使用Python創(chuàng)建一個(gè)功能完整的Windows風(fēng)格計(jì)算器程序,包含基本運(yùn)算和高級(jí)數(shù)學(xué)功能。
1. 使用Tkinter實(shí)現(xiàn)基礎(chǔ)計(jì)算器
import tkinter as tk
from tkinter import ttk
import math
class Calculator:
def __init__(self, root):
self.root = root
self.root.title("高級(jí)計(jì)算器")
self.root.geometry("400x550")
self.root.resizable(False, False)
# 當(dāng)前輸入和結(jié)果
self.current_input = ""
self.previous_input = ""
self.operation = None
self.reset_input = False
# 創(chuàng)建界面
self.create_widgets()
def create_widgets(self):
# 顯示框
self.display_frame = ttk.Frame(self.root)
self.display_frame.pack(fill=tk.BOTH, padx=10, pady=10)
self.expression_var = tk.StringVar()
self.expression_label = ttk.Label(
self.display_frame,
textvariable=self.expression_var,
font=("Arial", 18),
anchor=tk.E
)
self.expression_label.pack(fill=tk.BOTH, expand=True)
self.result_var = tk.StringVar()
self.result_label = ttk.Label(
self.display_frame,
textvariable=self.result_var,
font=("Arial", 28, "bold"),
anchor=tk.E,
foreground="blue"
)
self.result_label.pack(fill=tk.BOTH, expand=True)
# 按鈕框架
self.buttons_frame = ttk.Frame(self.root)
self.buttons_frame.pack(fill=tk.BOTH, expand=True)
# 按鈕布局
buttons = [
("C", 0, 0, "#FF9500", self.clear_all),
("?", 0, 1, "#FF9500", self.delete_last),
("÷", 0, 2, "#FF9500", lambda: self.add_operation("/")),
("×", 0, 3, "#FF9500", lambda: self.add_operation("*")),
("7", 1, 0, "#333333", lambda: self.add_number("7")),
("8", 1, 1, "#333333", lambda: self.add_number("8")),
("9", 1, 2, "#333333", lambda: self.add_number("9")),
("-", 1, 3, "#FF9500", lambda: self.add_operation("-")),
("4", 2, 0, "#333333", lambda: self.add_number("4")),
("5", 2, 1, "#333333", lambda: self.add_number("5")),
("6", 2, 2, "#333333", lambda: self.add_number("6")),
("+", 2, 3, "#FF9500", lambda: self.add_operation("+")),
("1", 3, 0, "#333333", lambda: self.add_number("1")),
("2", 3, 1, "#333333", lambda: self.add_number("2")),
("3", 3, 2, "#333333", lambda: self.add_number("3")),
("=", 3, 3, "#4CD964", self.calculate),
("0", 4, 0, "#333333", lambda: self.add_number("0")),
(".", 4, 1, "#333333", lambda: self.add_number(".")),
("(", 4, 2, "#333333", lambda: self.add_number("(")),
(")", 4, 3, "#333333", lambda: self.add_number(")")),
# 高級(jí)功能按鈕
("sin", 5, 0, "#5856D6", lambda: self.add_function("math.sin(")),
("cos", 5, 1, "#5856D6", lambda: self.add_function("math.cos(")),
("tan", 5, 2, "#5856D6", lambda: self.add_function("math.tan(")),
("log", 5, 3, "#5856D6", lambda: self.add_function("math.log10(")),
("√", 6, 0, "#5856D6", lambda: self.add_function("math.sqrt(")),
("x2", 6, 1, "#5856D6", lambda: self.add_operation("**2")),
("x3", 6, 2, "#5856D6", lambda: self.add_operation("**3")),
("π", 6, 3, "#5856D6", lambda: self.add_number(str(math.pi))),
("e", 7, 0, "#5856D6", lambda: self.add_number(str(math.e))),
("x^y", 7, 1, "#5856D6", lambda: self.add_operation("**")),
("(", 7, 2, "#333333", lambda: self.add_number("(")),
(")", 7, 3, "#333333", lambda: self.add_number(")")),
("Ans", 8, 0, "#5856D6", lambda: self.add_number(str(self.previous_result))),
("1/x", 8, 1, "#5856D6", lambda: self.add_function("1/(" + self.current_input + ")")),
("n!", 8, 2, "#5856D6", lambda: self.add_function("math.factorial(int(" + self.current_input + "))" if self.current_input.isdigit() else "")),
("(", 8, 3, "#333333", lambda: self.add_number("(")),
]
# 創(chuàng)建按鈕
for (text, row, col, color, command) in buttons:
button = ttk.Button(
self.buttons_frame,
text=text,
command=command
)
if text.isdigit() or text in [".", "+", "-", "*", "/", "(", ")", "^"]:
button.configure(style="Number.TButton")
elif text in ["sin", "cos", "tan", "log", "√", "x2", "x3", "Ans", "1/x", "n!"]:
button.configure(style="Function.TButton")
else:
button.configure(style="Operator.TButton")
button.grid(row=row, column=col, sticky="nsew", padx=5, pady=5)
# 配置網(wǎng)格權(quán)重
self.buttons_frame.grid_rowconfigure(row, weight=1)
self.buttons_frame.grid_columnconfigure(col, weight=1)
# 設(shè)置按鈕樣式
style = ttk.Style()
style.configure("TButton", font=("Arial", 14))
style.map("TButton",
foreground=[('pressed', 'white'), ('active', '#007AFF')],
background=[('pressed', '#007AFF'), ('active', '#007AFF')],
relief=[('pressed', 'flat'), ('active', 'flat')])
style.configure("Number.TButton", background="#F2F2F7")
style.configure("Operator.TButton", background="#FF9500", foreground="white")
style.configure("Function.TButton", background="#5856D6", foreground="white")
# 計(jì)算結(jié)果變量
self.previous_result = 0
def add_number(self, number):
if self.reset_input:
self.current_input = ""
self.reset_input = False
if number == "." and "." in self.current_input:
return
self.current_input += number
self.expression_var.set(self.current_input)
def add_operation(self, operation):
if self.current_input == "" and self.previous_input == "":
return
if self.previous_input:
self.calculate()
self.operation = operation
else:
self.operation = operation
self.previous_input = self.current_input
self.current_input = ""
self.expression_var.set(self.previous_input + " " + operation)
def add_function(self, function):
if self.reset_input:
self.current_input = ""
self.reset_input = False
# 檢查是否需要添加括號(hào)
if not (self.current_input.endswith(")") or self.current_input == ""):
self.current_input += ")"
self.current_input += function
if not self.current_input.endswith(")"):
self.current_input += "("
self.expression_var.set(self.current_input)
def clear_all(self):
self.current_input = ""
self.previous_input = ""
self.operation = None
self.reset_input = False
self.expression_var.set("")
self.result_var.set("")
def delete_last(self):
if self.current_input:
self.current_input = self.current_input[:-1]
self.expression_var.set(self.current_input if self.current_input else "")
elif self.previous_input:
self.previous_input = self.previous_input[:-1]
self.expression_var.set(self.previous_input if self.previous_input else "")
def calculate(self):
try:
# 替換x為*用于計(jì)算
expression = self.current_input.replace("^", "**")
# 處理特殊函數(shù)
if "sin(" in expression:
expression = expression.replace("sin(", "math.sin(")
if "cos(" in expression:
expression = expression.replace("cos(", "math.cos(")
if "tan(" in expression:
expression = expression.replace("tan(", "math.tan(")
if "log(" in expression:
expression = expression.replace("log(", "math.log10(")
if "√(" in expression:
expression = expression.replace("√(", "math.sqrt(")
result = eval(expression, {"math": math})
self.previous_input = str(result)
self.current_input = str(result)
self.expression_var.set(str(result))
self.result_var.set("=" + str(result))
self.previous_result = result
self.reset_input = True
except Exception as e:
self.expression_var.set("錯(cuò)誤")
self.result_var.set("")
self.current_input = ""
self.previous_input = ""
self.reset_input = False
@property
def current_input(self):
return self._current_input
@current_input.setter
def current_input(self, value):
self._current_input = value
# 創(chuàng)建主窗口并運(yùn)行計(jì)算器
if __name__ == "__main__":
import math
root = tk.Tk()
calculator = Calculator(root)
# 添加自定義樣式
style = ttk.Style()
style.theme_use('clam')
root.mainloop()2. 高級(jí)功能實(shí)現(xiàn)
2.1 科學(xué)計(jì)算功能
上述代碼已經(jīng)實(shí)現(xiàn)了以下高級(jí)功能:
- 三角函數(shù):sin, cos, tan
- 對(duì)數(shù)函數(shù):log10
- 平方根:√
- 冪運(yùn)算:x², x³, x^y
- 常數(shù):π, e
- 階乘:n!
- 反函數(shù):1/x
2.2 歷史記錄功能(擴(kuò)展)
要添加歷史記錄功能,可以修改代碼如下:
class Calculator:
def __init__(self, root):
# ... 其他初始化代碼 ...
self.history = [] # 存儲(chǔ)計(jì)算歷史
def calculate(self):
try:
# ... 計(jì)算代碼 ...
# 添加到歷史記錄
if self.previous_input and self.operation and self.current_input:
expression = f"{self.previous_input} {self.operation} {self.current_input}"
self.history.append((expression, str(result)))
if len(self.history) > 10: # 限制歷史記錄數(shù)量
self.history.pop(0)
# ... 其他代碼 ...
except Exception as e:
# ... 錯(cuò)誤處理代碼 ...
def show_history(self):
# 創(chuàng)建新窗口顯示歷史記錄
history_window = tk.Toplevel(self.root)
history_window.title("計(jì)算歷史")
history_window.geometry("350x400")
history_text = tk.Text(history_window, font=("Arial", 12))
history_text.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
for expr, res in self.history:
history_text.insert(tk.END, f"{expr} = {res}\n")
history_text.config(state=tk.DISABLED)2.3 圖形繪制功能(擴(kuò)展)
要添加函數(shù)圖形繪制功能,可以使用matplotlib:
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
class Calculator:
# ... 其他代碼 ...
def plot_function(self):
function_window = tk.Toplevel(self.root)
function_window.title("函數(shù)繪圖")
function_window.geometry("600x500")
# 創(chuàng)建輸入框
input_frame = ttk.Frame(function_window)
input_frame.pack(fill=tk.X, padx=10, pady=10)
ttk.Label(input_frame, text="輸入函數(shù) (使用x作為變量):").pack(side=tk.LEFT)
function_entry = ttk.Entry(input_frame, width=30)
function_entry.pack(side=tk.LEFT, padx=5)
function_entry.insert(0, "math.sin(x)") # 默認(rèn)函數(shù)
# 創(chuàng)建繪圖區(qū)域
fig_frame = ttk.Frame(function_window)
fig_frame.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
fig, ax = plt.subplots(figsize=(6, 5))
canvas = FigureCanvasTkAgg(fig, master=fig_frame)
canvas.get_tk_widget().pack(fill=tk.BOTH, expand=True)
# 繪制按鈕
def draw_plot():
try:
func_str = function_entry.get()
x = np.linspace(-10, 10, 400)
y = eval(func_str, {"math": math, "x": x, "np": np})
ax.clear()
ax.plot(x, y)
ax.set_title(f"y = {func_str}")
ax.grid(True)
canvas.draw()
except Exception as e:
messagebox.showerror("錯(cuò)誤", f"無(wú)法繪制函數(shù): {str(e)}")
ttk.Button(function_window, text="繪制", command=draw_plot).pack(pady=5)3. 完整功能整合
將上述功能整合到一個(gè)完整的計(jì)算器程序中:
import tkinter as tk
from tkinter import ttk, messagebox
import math
import numpy as np
class AdvancedCalculator:
def __init__(self, root):
self.root = root
self.root.title("高級(jí)科學(xué)計(jì)算器")
self.root.geometry("500x650")
self.root.resizable(False, False)
self.current_input = ""
self.previous_input = ""
self.operation = None
self.reset_input = False
self.history = []
self.create_widgets()
def create_widgets(self):
# 顯示框
self.display_frame = ttk.Frame(self.root)
self.display_frame.pack(fill=tk.BOTH, padx=10, pady=10)
self.expression_var = tk.StringVar()
self.expression_label = ttk.Label(
self.display_frame,
textvariable=self.expression_var,
font=("Arial", 14),
anchor=tk.E
)
self.expression_label.pack(fill=tk.BOTH, expand=True)
self.result_var = tk.StringVar()
self.result_label = ttk.Label(
self.display_frame,
textvariable=self.result_var,
font=("Arial", 24, "bold"),
anchor=tk.E,
foreground="blue"
)
self.result_label.pack(fill=tk.BOTH, expand=True)
# 按鈕框架
self.buttons_frame = ttk.Frame(self.root)
self.buttons_frame.pack(fill=tk.BOTH, expand=True)
# 按鈕布局
buttons = [
# 第一行
("C", 0, 0, "#FF9500", self.clear_all),
("?", 0, 1, "#FF9500", self.delete_last),
("÷", 0, 2, "#FF9500", lambda: self.add_operation("/")),
("×", 0, 3, "#FF9500", lambda: self.add_operation("*")),
# 第二行
("7", 1, 0, "#333333", lambda: self.add_number("7")),
("8", 1, 1, "#333333", lambda: self.add_number("8")),
("9", 1, 2, "#333333", lambda: self.add_number("9")),
("-", 1, 3, "#FF9500", lambda: self.add_operation("-")),
# 第三行
("4", 2, 0, "#333333", lambda: self.add_number("4")),
("5", 2, 1, "#333333", lambda: self.add_number("5")),
("6", 2, 2, "#333333", lambda: self.add_number("6")),
("+", 2, 3, "#FF9500", lambda: self.add_operation("+")),
# 第四行
("1", 3, 0, "#333333", lambda: self.add_number("1")),
("2", 3, 1, "#333333", lambda: self.add_number("2")),
("3", 3, 2, "#333333", lambda: self.add_number("3")),
("=", 3, 3, "#4CD964", self.calculate),
# 第五行
("0", 4, 0, "#333333", lambda: self.add_number("0")),
(".", 4, 1, "#333333", lambda: self.add_number(".")),
("(", 4, 2, "#333333", lambda: self.add_number("(")),
(")", 4, 3, "#333333", lambda: self.add_number(")")),
# 第六行 - 高級(jí)功能
("sin", 5, 0, "#5856D6", lambda: self.add_function("math.sin(")),
("cos", 5, 1, "#5856D6", lambda: self.add_function("math.cos(")),
("tan", 5, 2, "#5856D6", lambda: self.add_function("math.tan(")),
("log", 5, 3, "#5856D6", lambda: self.add_function("math.log10(")),
# 第七行
("√", 6, 0, "#5856D6", lambda: self.add_function("math.sqrt(")),
("x2", 6, 1, "#5856D6", lambda: self.add_operation("**2")),
("x3", 6, 2, "#5856D6", lambda: self.add_operation("**3")),
("π", 6, 3, "#5856D6", lambda: self.add_number(str(math.pi))),
# 第八行
("e", 7, 0, "#5856D6", lambda: self.add_number(str(math.e))),
("x^y", 7, 1, "#5856D6", lambda: self.add_operation("**")),
("(", 7, 2, "#333333", lambda: self.add_number("(")),
(")", 7, 3, "#333333", lambda: self.add_number(")")),
# 第九行
("Ans", 8, 0, "#5856D6", lambda: self.add_number(str(self.previous_result))),
("1/x", 8, 1, "#5856D6", lambda: self.add_function("1/(" + self.current_input + ")")),
("n!", 8, 2, "#5856D6", lambda: self.add_function("math.factorial(int(" + self.current_input + "))" if self.current_input.isdigit() else "")),
("Hist", 8, 3, "#5856D6", self.show_history),
]
# 創(chuàng)建按鈕
for (text, row, col, color, command) in buttons:
button = ttk.Button(
self.buttons_frame,
text=text,
command=command
)
if text.isdigit() or text in [".", "+", "-", "*", "/", "(", ")", "^"]:
button.configure(style="Number.TButton")
elif text in ["sin", "cos", "tan", "log", "√", "x2", "x3", "Ans", "1/x", "n!"]:
button.configure(style="Function.TButton")
elif text in ["Hist"]:
button.configure(style="History.TButton")
else:
button.configure(style="Operator.TButton")
button.grid(row=row, column=col, sticky="nsew", padx=5, pady=5)
# 配置網(wǎng)格權(quán)重
self.buttons_frame.grid_rowconfigure(row, weight=1)
self.buttons_frame.grid_columnconfigure(col, weight=1)
# 設(shè)置按鈕樣式
style = ttk.Style()
style.configure("TButton", font=("Arial", 14))
style.map("TButton",
foreground=[('pressed', 'white'), ('active', '#007AFF')],
background=[('pressed', '#007AFF'), ('active', '#007AFF')],
relief=[('pressed', 'flat'), ('active', 'flat')])
style.configure("Number.TButton", background="#F2F2F7")
style.configure("Operator.TButton", background="#FF9500", foreground="white")
style.configure("Function.TButton", background="#5856D6", foreground="white")
style.configure("History.TButton", background="#8E8E93", foreground="white")
# 計(jì)算結(jié)果變量
self.previous_result = 0
def add_number(self, number):
if self.reset_input:
self.current_input = ""
self.reset_input = False
if number == "." and "." in self.current_input:
return
self.current_input += number
self.expression_var.set(self.current_input)
def add_operation(self, operation):
if self.current_input == "" and self.previous_input == "":
return
if self.previous_input:
self.calculate()
self.operation = operation
else:
self.operation = operation
self.previous_input = self.current_input
self.current_input = ""
self.expression_var.set(self.previous_input + " " + operation)
def add_function(self, function):
if self.reset_input:
self.current_input = ""
self.reset_input = False
# 檢查是否需要添加括號(hào)
if not (self.current_input.endswith(")") or self.current_input == ""):
self.current_input += ")"
self.current_input += function
if not self.current_input.endswith(")"):
self.current_input += "("
self.expression_var.set(self.current_input)
def clear_all(self):
self.current_input = ""
self.previous_input = ""
self.operation = None
self.reset_input = False
self.expression_var.set("")
self.result_var.set("")
def delete_last(self):
if self.current_input:
self.current_input = self.current_input[:-1]
self.expression_var.set(self.current_input if self.current_input else "")
elif self.previous_input:
self.previous_input = self.previous_input[:-1]
self.expression_var.set(self.previous_input if self.previous_input else "")
def calculate(self):
try:
# 替換x為*用于計(jì)算
expression = self.current_input.replace("^", "**")
# 處理特殊函數(shù)
if "sin(" in expression:
expression = expression.replace("sin(", "math.sin(")
if "cos(" in expression:
expression = expression.replace("cos(", "math.cos(")
if "tan(" in expression:
expression = expression.replace("tan(", "math.tan(")
if "log(" in expression:
expression = expression.replace("log(", "math.log10(")
if "√(" in expression:
expression = expression.replace("√(", "math.sqrt(")
result = eval(expression, {"math": math})
self.previous_input = str(result)
self.current_input = str(result)
self.expression_var.set(str(result))
self.result_var.set("=" + str(result))
self.previous_result = result
self.reset_input = True
# 添加到歷史記錄
if self.previous_input and self.operation and self.current_input:
expr = f"{self.previous_input} {self.operation} {self.current_input}"
self.history.append((expr, str(result)))
if len(self.history) > 10: # 限制歷史記錄數(shù)量
self.history.pop(0)
except Exception as e:
self.expression_var.set("錯(cuò)誤")
self.result_var.set("")
self.current_input = ""
self.previous_input = ""
self.reset_input = False
@property
def current_input(self):
return self._current_input
@current_input.setter
def current_input(self, value):
self._current_input = value
def show_history(self):
history_window = tk.Toplevel(self.root)
history_window.title("計(jì)算歷史")
history_window.geometry("400x400")
history_text = tk.Text(history_window, font=("Arial", 12))
history_text.pack(fill=tk.BOTH, expand=True, padx=10, pady=10)
for expr, res in self.history:
history_text.insert(tk.END, f"{expr} = {res}\n")
history_text.config(state=tk.DISABLED)
# 創(chuàng)建主窗口并運(yùn)行計(jì)算器
if __name__ == "__main__":
import math
root = tk.Tk()
# 添加自定義樣式
style = ttk.Style()
style.theme_use('clam')
calculator = AdvancedCalculator(root)
root.mainloop()4. 功能說(shuō)明
4.1 基本功能
- 支持加、減、乘、除基本運(yùn)算
- 支持括號(hào)和小數(shù)點(diǎn)
- 清除(C)和刪除(?)功能
4.2 高級(jí)科學(xué)計(jì)算功能
- 三角函數(shù):sin, cos, tan
- 對(duì)數(shù)函數(shù):log10
- 平方根:√
- 冪運(yùn)算:x², x³, x^y
- 常數(shù):π, e
- 階乘:n!
- 反函數(shù):1/x
4.3 額外功能
- 歷史記錄:記錄最近10次計(jì)算
- Ans功能:使用上一次的計(jì)算結(jié)果
5. 擴(kuò)展建議
- ??圖形繪制功能??:添加函數(shù)繪圖功能,可以使用matplotlib集成
- ??單位轉(zhuǎn)換??:添加長(zhǎng)度、重量、溫度等單位轉(zhuǎn)換功能
- ??方程求解??:添加一元二次方程等求解功能
- ??統(tǒng)計(jì)計(jì)算??:添加平均值、標(biāo)準(zhǔn)差等統(tǒng)計(jì)功能
- ??編程模式??:添加自定義函數(shù)定義功能
這個(gè)計(jì)算器程序提供了完整的科學(xué)計(jì)算功能,界面簡(jiǎn)潔直觀,適合學(xué)習(xí)和日常使用。
以上就是使用Python創(chuàng)建一個(gè)功能完整的Windows風(fēng)格計(jì)算器程序的詳細(xì)內(nèi)容,更多關(guān)于Python創(chuàng)建Windows系統(tǒng)計(jì)算器程序的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
詳解python 字符串和日期之間轉(zhuǎn)換 StringAndDate
這篇文章主要介紹了python 字符串和日期之間轉(zhuǎn)換 StringAndDate簡(jiǎn)單實(shí)例的相關(guān)資料,需要的朋友可以參考下2017-05-05
Python?pip命令清除Python包緩存文件問(wèn)題
這篇文章主要介紹了Python?pip命令清除Python包緩存文件問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03
Pandas統(tǒng)計(jì)重復(fù)的列里面的值方法
今天小編就為大家分享一篇Pandas統(tǒng)計(jì)重復(fù)的列里面的值方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-01-01
對(duì)python 通過(guò)ssh訪問(wèn)數(shù)據(jù)庫(kù)的實(shí)例詳解
今天小編就為大家分享一篇對(duì)python 通過(guò)ssh訪問(wèn)數(shù)據(jù)庫(kù)的實(shí)例詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-02-02
matplotlib如何設(shè)置坐標(biāo)軸刻度的個(gè)數(shù)及標(biāo)簽的方法總結(jié)
這里介紹兩種設(shè)置坐標(biāo)軸刻度的方法,一種是利用pyplot提交的api去進(jìn)行設(shè)置,另一種是通過(guò)調(diào)用面向?qū)ο蟮腶pi, 即通過(guò)matplotlib.axes.Axes去設(shè)置,需要的朋友可以參考下2021-06-06
pyx文件 生成pyd 文件用于 cython調(diào)用的實(shí)現(xiàn)
這篇文章主要介紹了pyx文件 生成pyd 文件用于 cython調(diào)用的實(shí)現(xiàn)方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2021-03-03
基于Python打造一個(gè)你的專屬中醫(yī)養(yǎng)生桌面時(shí)鐘
這篇文章主要和大家詳細(xì)介紹了一個(gè)有趣又有用的小項(xiàng)目,即使用 Python 編寫一個(gè)集成了公歷、農(nóng)歷和中醫(yī)十二時(shí)辰養(yǎng)生提示的桌面時(shí)鐘,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以了解下2026-01-01
在keras 中獲取張量 tensor 的維度大小實(shí)例
這篇文章主要介紹了在keras 中獲取張量 tensor 的維度大小實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-06-06
python使用matplotlib:subplot繪制多個(gè)子圖的示例
這篇文章主要介紹了python使用matplotlib:subplot繪制多個(gè)子圖的示例,幫助大家更好的利用python繪制圖像,感興趣的朋友可以了解下2020-09-09

