使用Python自制GUI版時(shí)間戳轉(zhuǎn)換器
前言
在日常開發(fā)工作中,我們經(jīng)常需要處理時(shí)間戳的轉(zhuǎn)換問題。無論是調(diào)試API接口、分析日志文件,還是進(jìn)行數(shù)據(jù)處理,時(shí)間戳的格式轉(zhuǎn)換都是一個(gè)常見需求。今天我將分享一個(gè)使用Python和Tkinter開發(fā)的時(shí)間戳轉(zhuǎn)換器GUI應(yīng)用,它能夠幫助開發(fā)者快速完成各種時(shí)間戳格式之間的轉(zhuǎn)換。
項(xiàng)目概述
這個(gè)時(shí)間戳轉(zhuǎn)換器具有以下核心功能:
- 獲取當(dāng)前時(shí)間戳(支持秒級(jí)和毫秒級(jí)精度)
- 時(shí)間戳轉(zhuǎn)換為可讀的時(shí)間字符串
- 時(shí)間字符串轉(zhuǎn)換為時(shí)間戳
- 支持自定義時(shí)間格式
- 一鍵復(fù)制轉(zhuǎn)換結(jié)果
- 友好的圖形用戶界面
技術(shù)架構(gòu)
核心依賴
import time import datetime import tkinter as tk from tkinter import ttk, messagebox from typing import Union
項(xiàng)目采用了Python標(biāo)準(zhǔn)庫,無需安裝額外的第三方依賴,具有良好的兼容性和可移植性。
架構(gòu)設(shè)計(jì)
應(yīng)用采用了經(jīng)典的MVC(Model-View-Controller)設(shè)計(jì)模式:
- Model層:
TimestampConverter類負(fù)責(zé)核心的時(shí)間戳轉(zhuǎn)換邏輯 - View層:
TimestampConverterGUI類負(fù)責(zé)用戶界面的構(gòu)建和顯示 - Controller層:GUI類中的事件處理方法負(fù)責(zé)用戶交互邏輯
核心功能實(shí)現(xiàn)
1. 時(shí)間戳轉(zhuǎn)換核心類
class TimestampConverter:
"""時(shí)間戳轉(zhuǎn)換器類"""
def current_timestamp(self, precision: str = 'seconds') -> Union[int, float]:
"""獲取當(dāng)前時(shí)間戳"""
if precision == 'milliseconds':
return int(time.time() * 1000)
return int(time.time())
def timestamp_to_string(self, timestamp: Union[int, float],
format_str: str = '%Y-%m-%d %H:%M:%S',
precision: str = 'seconds') -> str:
"""時(shí)間戳轉(zhuǎn)換為格式化字符串"""
dt = self.timestamp_to_datetime(timestamp, precision)
return dt.strftime(format_str)
def string_to_timestamp(self, time_str: str,
format_str: str = '%Y-%m-%d %H:%M:%S',
precision: str = 'seconds') -> Union[int, float]:
"""時(shí)間字符串轉(zhuǎn)換為時(shí)間戳"""
dt = datetime.datetime.strptime(time_str, format_str)
timestamp = dt.timestamp()
if precision == 'milliseconds':
return int(timestamp * 1000)
return int(timestamp)
設(shè)計(jì)亮點(diǎn):
- 使用類型注解提高代碼可讀性和IDE支持
- 支持秒級(jí)和毫秒級(jí)兩種精度
- 提供靈活的時(shí)間格式自定義功能
- 統(tǒng)一的異常處理機(jī)制
2. 用戶界面設(shè)計(jì)
界面采用Tkinter的ttk模塊,提供現(xiàn)代化的控件外觀:
def setup_ui(self):
"""設(shè)置用戶界面"""
self.root.title("時(shí)間戳轉(zhuǎn)換器")
self.root.geometry("600x600")
self.root.resizable(True, True)
# 創(chuàng)建主框架
main_frame = ttk.Frame(self.root, padding="10")
main_frame.grid(row=0, column=0, sticky=(tk.W, tk.E, tk.N, tk.S))
界面特色:
- 響應(yīng)式布局設(shè)計(jì),支持窗口大小調(diào)整
- 分區(qū)域功能布局,邏輯清晰
- 使用LabelFrame組織相關(guān)功能
- 提供常用格式提示,提升用戶體驗(yàn)
3. 功能區(qū)域詳解
當(dāng)前時(shí)間戳獲取區(qū)域
# 當(dāng)前時(shí)間戳區(qū)域
current_frame = ttk.LabelFrame(main_frame, text="當(dāng)前時(shí)間戳", padding="10")
ttk.Button(current_frame, text="獲取當(dāng)前時(shí)間戳(秒)",
command=self.get_current_timestamp_seconds)
ttk.Button(current_frame, text="獲取當(dāng)前時(shí)間戳(毫秒)",
command=self.get_current_timestamp_milliseconds)
這個(gè)區(qū)域允許用戶快速獲取當(dāng)前時(shí)間的時(shí)間戳,支持秒級(jí)和毫秒級(jí)兩種精度。
時(shí)間戳轉(zhuǎn)字符串區(qū)域
提供時(shí)間戳輸入框、精度選擇下拉框、格式輸入框和轉(zhuǎn)換按鈕,用戶可以將數(shù)字時(shí)間戳轉(zhuǎn)換為可讀的時(shí)間字符串。
字符串轉(zhuǎn)時(shí)間戳區(qū)域
與上一個(gè)區(qū)域功能相反,允許用戶輸入時(shí)間字符串和對(duì)應(yīng)的格式,轉(zhuǎn)換為時(shí)間戳。
4. 錯(cuò)誤處理機(jī)制
def convert_timestamp_to_string(self):
"""時(shí)間戳轉(zhuǎn)字符串"""
try:
timestamp_str = self.timestamp_input.get().strip()
if not timestamp_str:
messagebox.showerror("錯(cuò)誤", "請(qǐng)輸入時(shí)間戳")
return
timestamp = float(timestamp_str)
precision = self.ts_precision.get()
format_str = self.format_input.get()
result = self.converter.timestamp_to_string(timestamp, format_str, precision)
self.ts_result.set(result)
except ValueError as e:
messagebox.showerror("錯(cuò)誤", f"時(shí)間戳格式錯(cuò)誤: {str(e)}")
except Exception as e:
messagebox.showerror("錯(cuò)誤", f"轉(zhuǎn)換失敗: {str(e)}")
錯(cuò)誤處理特點(diǎn):
- 輸入驗(yàn)證:檢查空輸入和格式錯(cuò)誤
- 分類異常處理:區(qū)分不同類型的錯(cuò)誤
- 用戶友好的錯(cuò)誤提示
- 程序穩(wěn)定性保障
實(shí)用功能特性
1. 一鍵復(fù)制功能
def copy_to_clipboard(self, text):
"""復(fù)制文本到剪貼板"""
if text:
self.root.clipboard_clear()
self.root.clipboard_append(text)
messagebox.showinfo("成功", "已復(fù)制到剪貼板")
else:
messagebox.showwarning("警告", "沒有內(nèi)容可復(fù)制")
每個(gè)轉(zhuǎn)換結(jié)果都配備了復(fù)制按鈕,方便用戶快速復(fù)制結(jié)果到其他應(yīng)用中使用。
2. 常用格式提示
應(yīng)用內(nèi)置了常用的時(shí)間格式示例:
%Y-%m-%d %H:%M:%S→2024-01-01 12:00:00%Y年%m月%d日 %H時(shí)%M分%S秒→2024年01月01日 12時(shí)00分00秒%Y/%m/%d %H:%M:%S→2024/01/01 12:00:00%Y-%m-%dT%H:%M:%S→2024-01-01T12:00:00(ISO格式)
3. 精度支持
應(yīng)用支持秒級(jí)和毫秒級(jí)兩種時(shí)間戳精度,滿足不同場景的需求:
- 秒級(jí)時(shí)間戳:適用于一般的時(shí)間記錄和轉(zhuǎn)換
- 毫秒級(jí)時(shí)間戳:適用于需要高精度時(shí)間的場景,如性能分析、日志記錄等
使用場景
這個(gè)時(shí)間戳轉(zhuǎn)換器在以下場景中特別有用:
- API開發(fā)調(diào)試:快速轉(zhuǎn)換API返回的時(shí)間戳
- 日志分析:將日志中的時(shí)間戳轉(zhuǎn)換為可讀格式
- 數(shù)據(jù)處理:批量處理包含時(shí)間戳的數(shù)據(jù)
- 系統(tǒng)集成:不同系統(tǒng)間的時(shí)間格式轉(zhuǎn)換
- 學(xué)習(xí)研究:理解時(shí)間戳的概念和轉(zhuǎn)換原理
運(yùn)行方式
python timestamp_converter_gui.py
程序啟動(dòng)后會(huì)顯示一個(gè)600x600像素的窗口,包含所有轉(zhuǎn)換功能。界面支持窗口大小調(diào)整,適應(yīng)不同的屏幕尺寸。
技術(shù)總結(jié)
優(yōu)點(diǎn)
- 零依賴:僅使用Python標(biāo)準(zhǔn)庫,無需安裝額外包
- 跨平臺(tái):支持Windows、macOS、Linux等操作系統(tǒng)
- 用戶友好:直觀的圖形界面,操作簡單
- 功能完整:覆蓋常見的時(shí)間戳轉(zhuǎn)換需求
- 代碼規(guī)范:良好的代碼結(jié)構(gòu)和注釋
可擴(kuò)展性
代碼采用面向?qū)ο笤O(shè)計(jì),具有良好的可擴(kuò)展性:
- 可以輕松添加新的時(shí)間格式
- 可以擴(kuò)展支持更多的時(shí)間戳精度
- 可以添加批量轉(zhuǎn)換功能
- 可以集成到更大的應(yīng)用系統(tǒng)中
完整代碼
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
時(shí)間戳轉(zhuǎn)換器 - GUI版本
支持多種時(shí)間戳格式的相互轉(zhuǎn)換,提供圖形界面
"""
import time
import datetime
import tkinter as tk
from tkinter import ttk, messagebox
from typing import Union
class TimestampConverter:
"""時(shí)間戳轉(zhuǎn)換器類"""
def __init__(self):
"""初始化轉(zhuǎn)換器"""
pass
def current_timestamp(self, precision: str = 'seconds') -> Union[int, float]:
"""
獲取當(dāng)前時(shí)間戳
Args:
precision: 精度,'seconds'(秒) 或 'milliseconds'(毫秒)
Returns:
當(dāng)前時(shí)間戳
"""
if precision == 'milliseconds':
return int(time.time() * 1000)
return int(time.time())
def timestamp_to_datetime(self, timestamp: Union[int, float],
precision: str = 'seconds') -> datetime.datetime:
"""
時(shí)間戳轉(zhuǎn)換為datetime對(duì)象
Args:
timestamp: 時(shí)間戳
precision: 精度,'seconds'(秒) 或 'milliseconds'(毫秒)
Returns:
datetime對(duì)象
"""
if precision == 'milliseconds':
timestamp = timestamp / 1000
return datetime.datetime.fromtimestamp(timestamp)
def timestamp_to_string(self, timestamp: Union[int, float],
format_str: str = '%Y-%m-%d %H:%M:%S',
precision: str = 'seconds') -> str:
"""
時(shí)間戳轉(zhuǎn)換為格式化字符串
Args:
timestamp: 時(shí)間戳
format_str: 格式化字符串
precision: 精度,'seconds'(秒) 或 'milliseconds'(毫秒)
Returns:
格式化的時(shí)間字符串
"""
dt = self.timestamp_to_datetime(timestamp, precision)
return dt.strftime(format_str)
def string_to_timestamp(self, time_str: str,
format_str: str = '%Y-%m-%d %H:%M:%S',
precision: str = 'seconds') -> Union[int, float]:
"""
時(shí)間字符串轉(zhuǎn)換為時(shí)間戳
Args:
time_str: 時(shí)間字符串
format_str: 格式化字符串
precision: 精度,'seconds'(秒) 或 'milliseconds'(毫秒)
Returns:
時(shí)間戳
"""
dt = datetime.datetime.strptime(time_str, format_str)
timestamp = dt.timestamp()
if precision == 'milliseconds':
return int(timestamp * 1000)
return int(timestamp)
def convert_precision(self, timestamp: Union[int, float],
from_precision: str, to_precision: str) -> Union[int, float]:
"""
轉(zhuǎn)換時(shí)間戳精度
Args:
timestamp: 原時(shí)間戳
from_precision: 原精度,'seconds' 或 'milliseconds'
to_precision: 目標(biāo)精度,'seconds' 或 'milliseconds'
Returns:
轉(zhuǎn)換后的時(shí)間戳
"""
if from_precision == to_precision:
return timestamp
if from_precision == 'seconds' and to_precision == 'milliseconds':
return int(timestamp * 1000)
elif from_precision == 'milliseconds' and to_precision == 'seconds':
return int(timestamp / 1000)
else:
raise ValueError("不支持的精度轉(zhuǎn)換")
class TimestampConverterGUI:
"""時(shí)間戳轉(zhuǎn)換器圖形界面"""
def __init__(self, root):
self.root = root
self.converter = TimestampConverter()
self.setup_ui()
def setup_ui(self):
"""設(shè)置用戶界面"""
self.root.title("時(shí)間戳轉(zhuǎn)換器")
self.root.geometry("600x600")
self.root.resizable(True, True)
# 創(chuàng)建主框架
main_frame = ttk.Frame(self.root, padding="10")
main_frame.grid(row=0, column=0, sticky=(tk.W, tk.E, tk.N, tk.S))
# 配置網(wǎng)格權(quán)重
self.root.columnconfigure(0, weight=1)
self.root.rowconfigure(0, weight=1)
main_frame.columnconfigure(1, weight=1)
# 標(biāo)題
title_label = ttk.Label(main_frame, text="時(shí)間戳轉(zhuǎn)換器(作者:小莊-Python辦公)", font=('Arial', 16, 'bold'))
title_label.grid(row=0, column=0, columnspan=3, pady=(0, 20))
# 當(dāng)前時(shí)間戳區(qū)域
current_frame = ttk.LabelFrame(main_frame, text="當(dāng)前時(shí)間戳", padding="10")
current_frame.grid(row=1, column=0, columnspan=3, sticky=(tk.W, tk.E), pady=(0, 10))
current_frame.columnconfigure(1, weight=1)
ttk.Button(current_frame, text="獲取當(dāng)前時(shí)間戳(秒)",
command=self.get_current_timestamp_seconds).grid(row=0, column=0, padx=(0, 10))
self.current_ts_seconds = tk.StringVar()
ttk.Entry(current_frame, textvariable=self.current_ts_seconds,
state="readonly").grid(row=0, column=1, sticky=(tk.W, tk.E), padx=(0, 10))
ttk.Button(current_frame, text="復(fù)制",
command=lambda: self.copy_to_clipboard(self.current_ts_seconds.get())).grid(row=0, column=2)
ttk.Button(current_frame, text="獲取當(dāng)前時(shí)間戳(毫秒)",
command=self.get_current_timestamp_milliseconds).grid(row=1, column=0, padx=(0, 10), pady=(5, 0))
self.current_ts_milliseconds = tk.StringVar()
ttk.Entry(current_frame, textvariable=self.current_ts_milliseconds,
state="readonly").grid(row=1, column=1, sticky=(tk.W, tk.E), padx=(0, 10), pady=(5, 0))
ttk.Button(current_frame, text="復(fù)制",
command=lambda: self.copy_to_clipboard(self.current_ts_milliseconds.get())).grid(row=1, column=2, pady=(5, 0))
# 時(shí)間戳轉(zhuǎn)字符串區(qū)域
ts_to_str_frame = ttk.LabelFrame(main_frame, text="時(shí)間戳 → 字符串", padding="10")
ts_to_str_frame.grid(row=2, column=0, columnspan=3, sticky=(tk.W, tk.E), pady=(0, 10))
ts_to_str_frame.columnconfigure(1, weight=1)
ttk.Label(ts_to_str_frame, text="時(shí)間戳:").grid(row=0, column=0, sticky=tk.W)
self.timestamp_input = tk.StringVar()
ttk.Entry(ts_to_str_frame, textvariable=self.timestamp_input).grid(row=0, column=1, sticky=(tk.W, tk.E), padx=(10, 10))
ttk.Label(ts_to_str_frame, text="精度:").grid(row=0, column=2, sticky=tk.W)
self.ts_precision = tk.StringVar(value="seconds")
precision_combo = ttk.Combobox(ts_to_str_frame, textvariable=self.ts_precision,
values=["seconds", "milliseconds"], state="readonly", width=12)
precision_combo.grid(row=0, column=3, padx=(10, 0))
ttk.Label(ts_to_str_frame, text="格式:").grid(row=1, column=0, sticky=tk.W, pady=(10, 0))
self.format_input = tk.StringVar(value="%Y-%m-%d %H:%M:%S")
ttk.Entry(ts_to_str_frame, textvariable=self.format_input).grid(row=1, column=1, sticky=(tk.W, tk.E), padx=(10, 10), pady=(10, 0))
ttk.Button(ts_to_str_frame, text="轉(zhuǎn)換",
command=self.convert_timestamp_to_string).grid(row=1, column=2, columnspan=2, padx=(10, 0), pady=(10, 0))
ttk.Label(ts_to_str_frame, text="結(jié)果:").grid(row=2, column=0, sticky=tk.W, pady=(10, 0))
self.ts_result = tk.StringVar()
result_entry = ttk.Entry(ts_to_str_frame, textvariable=self.ts_result, state="readonly")
result_entry.grid(row=2, column=1, sticky=(tk.W, tk.E), padx=(10, 10), pady=(10, 0))
ttk.Button(ts_to_str_frame, text="復(fù)制",
command=lambda: self.copy_to_clipboard(self.ts_result.get())).grid(row=2, column=2, columnspan=2, padx=(10, 0), pady=(10, 0))
# 字符串轉(zhuǎn)時(shí)間戳區(qū)域
str_to_ts_frame = ttk.LabelFrame(main_frame, text="字符串 → 時(shí)間戳", padding="10")
str_to_ts_frame.grid(row=3, column=0, columnspan=3, sticky=(tk.W, tk.E), pady=(0, 10))
str_to_ts_frame.columnconfigure(1, weight=1)
ttk.Label(str_to_ts_frame, text="時(shí)間字符串:").grid(row=0, column=0, sticky=tk.W)
self.time_string_input = tk.StringVar()
ttk.Entry(str_to_ts_frame, textvariable=self.time_string_input).grid(row=0, column=1, sticky=(tk.W, tk.E), padx=(10, 10))
ttk.Label(str_to_ts_frame, text="輸出精度:").grid(row=0, column=2, sticky=tk.W)
self.output_precision = tk.StringVar(value="seconds")
output_precision_combo = ttk.Combobox(str_to_ts_frame, textvariable=self.output_precision,
values=["seconds", "milliseconds"], state="readonly", width=12)
output_precision_combo.grid(row=0, column=3, padx=(10, 0))
ttk.Label(str_to_ts_frame, text="輸入格式:").grid(row=1, column=0, sticky=tk.W, pady=(10, 0))
self.input_format = tk.StringVar(value="%Y-%m-%d %H:%M:%S")
ttk.Entry(str_to_ts_frame, textvariable=self.input_format).grid(row=1, column=1, sticky=(tk.W, tk.E), padx=(10, 10), pady=(10, 0))
ttk.Button(str_to_ts_frame, text="轉(zhuǎn)換",
command=self.convert_string_to_timestamp).grid(row=1, column=2, columnspan=2, padx=(10, 0), pady=(10, 0))
ttk.Label(str_to_ts_frame, text="結(jié)果:").grid(row=2, column=0, sticky=tk.W, pady=(10, 0))
self.str_result = tk.StringVar()
str_result_entry = ttk.Entry(str_to_ts_frame, textvariable=self.str_result, state="readonly")
str_result_entry.grid(row=2, column=1, sticky=(tk.W, tk.E), padx=(10, 10), pady=(10, 0))
ttk.Button(str_to_ts_frame, text="復(fù)制",
command=lambda: self.copy_to_clipboard(self.str_result.get())).grid(row=2, column=2, columnspan=2, padx=(10, 0), pady=(10, 0))
# 常用格式提示
tips_frame = ttk.LabelFrame(main_frame, text="常用格式提示", padding="10")
tips_frame.grid(row=4, column=0, columnspan=3, sticky=(tk.W, tk.E), pady=(0, 10))
tips_text = (
"%Y-%m-%d %H:%M:%S → 2024-01-01 12:00:00\n"
"%Y年%m月%d日 %H時(shí)%M分%S秒 → 2024年01月01日 12時(shí)00分00秒\n"
"%Y/%m/%d %H:%M:%S → 2024/01/01 12:00:00\n"
"%Y-%m-%dT%H:%M:%S → 2024-01-01T12:00:00 (ISO格式)"
)
ttk.Label(tips_frame, text=tips_text, font=('Consolas', 9)).grid(row=0, column=0, sticky=tk.W)
def get_current_timestamp_seconds(self):
"""獲取當(dāng)前秒級(jí)時(shí)間戳"""
timestamp = self.converter.current_timestamp('seconds')
self.current_ts_seconds.set(str(timestamp))
def get_current_timestamp_milliseconds(self):
"""獲取當(dāng)前毫秒級(jí)時(shí)間戳"""
timestamp = self.converter.current_timestamp('milliseconds')
self.current_ts_milliseconds.set(str(timestamp))
def convert_timestamp_to_string(self):
"""時(shí)間戳轉(zhuǎn)字符串"""
try:
timestamp_str = self.timestamp_input.get().strip()
if not timestamp_str:
messagebox.showerror("錯(cuò)誤", "請(qǐng)輸入時(shí)間戳")
return
timestamp = float(timestamp_str)
precision = self.ts_precision.get()
format_str = self.format_input.get()
result = self.converter.timestamp_to_string(timestamp, format_str, precision)
self.ts_result.set(result)
except ValueError as e:
messagebox.showerror("錯(cuò)誤", f"時(shí)間戳格式錯(cuò)誤: {str(e)}")
except Exception as e:
messagebox.showerror("錯(cuò)誤", f"轉(zhuǎn)換失敗: {str(e)}")
def convert_string_to_timestamp(self):
"""字符串轉(zhuǎn)時(shí)間戳"""
try:
time_str = self.time_string_input.get().strip()
if not time_str:
messagebox.showerror("錯(cuò)誤", "請(qǐng)輸入時(shí)間字符串")
return
format_str = self.input_format.get()
precision = self.output_precision.get()
result = self.converter.string_to_timestamp(time_str, format_str, precision)
self.str_result.set(str(result))
except ValueError as e:
messagebox.showerror("錯(cuò)誤", f"時(shí)間格式錯(cuò)誤: {str(e)}")
except Exception as e:
messagebox.showerror("錯(cuò)誤", f"轉(zhuǎn)換失敗: {str(e)}")
def copy_to_clipboard(self, text):
"""復(fù)制文本到剪貼板"""
if text:
self.root.clipboard_clear()
self.root.clipboard_append(text)
messagebox.showinfo("成功", "已復(fù)制到剪貼板")
else:
messagebox.showwarning("警告", "沒有內(nèi)容可復(fù)制")
def main():
"""主函數(shù)"""
root = tk.Tk()
app = TimestampConverterGUI(root)
root.mainloop()
if __name__ == "__main__":
main()
效果圖

結(jié)尾
這個(gè)時(shí)間戳轉(zhuǎn)換器雖然功能相對(duì)簡單,但展示了如何使用Python和Tkinter構(gòu)建實(shí)用的桌面應(yīng)用程序。它不僅解決了開發(fā)者日常工作中的實(shí)際問題,也是學(xué)習(xí)GUI編程和時(shí)間處理的良好示例。
通過這個(gè)項(xiàng)目,我們可以學(xué)到:
- Python GUI編程的基本技巧
- 時(shí)間戳處理的常用方法
- 用戶界面設(shè)計(jì)的基本原則
- 錯(cuò)誤處理和用戶體驗(yàn)優(yōu)化
到此這篇關(guān)于使用Python自制GUI版時(shí)間戳轉(zhuǎn)換器的文章就介紹到這了,更多相關(guān)Python時(shí)間戳轉(zhuǎn)換內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Pandas DataFrame 取一行數(shù)據(jù)會(huì)得到Series的方法
今天小編就為大家分享一篇Pandas DataFrame 取一行數(shù)據(jù)會(huì)得到Series的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-11-11
Django DRF Token認(rèn)證基本使用小結(jié)
本文介紹了在DjangoRestFramework中使用Token進(jìn)行用戶認(rèn)證,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2025-12-12
python統(tǒng)計(jì)指定目錄內(nèi)文件的代碼行數(shù)
這篇文章主要介紹了python統(tǒng)計(jì)指定目錄內(nèi)文件的代碼行數(shù)2019-09-09
使用python如何實(shí)現(xiàn)泛型函數(shù)
這篇文章主要介紹了使用python如何實(shí)現(xiàn)泛型函數(shù),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-09-09
淺談Python任務(wù)自動(dòng)化工具Tox基本用法
這篇文章主要介紹了淺談Python任務(wù)自動(dòng)化工具Tox,tox 是一個(gè)管理測試虛擬環(huán)境的命令行工具, 它已存在多年且廣被開發(fā)者們使用,對(duì)Python任務(wù)自動(dòng)化工具Tox基本用法感興趣的朋友一起看看吧2022-06-06
關(guān)于pytorch中網(wǎng)絡(luò)loss傳播和參數(shù)更新的理解
今天小編就為大家分享一篇關(guān)于pytorch中網(wǎng)絡(luò)loss傳播和參數(shù)更新的理解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2019-08-08

