最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于Python實(shí)現(xiàn)一個(gè)Word表格合并單元格工具

 更新時(shí)間:2025年11月28日 09:32:25   作者:溫輕舟  
這篇文章主要介紹了如何基于Python實(shí)現(xiàn)一個(gè)Word表格合并單元格工具,用于處理Word文檔中的表格,主要功能是合并指定列中內(nèi)容相同的單元格,并支持多種格式設(shè)置選項(xiàng),需要的朋友可以參考下

一:效果展示:

本項(xiàng)目是基于PyQt5和python-docx庫開發(fā)的圖形界面應(yīng)用程序,用于處理Word文檔中的表格,主要功能是合并指定列中內(nèi)容相同的單元格,并支持多種格式設(shè)置選項(xiàng)

二:功能描述:

1. 核心功能

(1)文件選擇功能

  • 選擇Word文件:用戶可以通過文件對話框選擇要處理的.docx文件
  • 文件路徑顯示:顯示當(dāng)前選擇的文件路徑
  • 文件加載驗(yàn)證:檢查文件是否能正常加載,并給出反饋

(2)表格設(shè)置功能

  • 表格索引選擇:指定要處理的文檔中的表格(支持多個(gè)表格的文檔)
  • 表頭行數(shù)設(shè)置:指定表格中不參與合并的表頭行數(shù)
  • 表尾行數(shù)設(shè)置:指定表格中不參與合并的表尾行數(shù)

(3)合并設(shè)置功能

  • 指定要合并的列索引
  • 啟用/禁用該列的合并功能
  • 字體大小設(shè)置(8-72磅)
  • 文本加粗選項(xiàng)
  • 單元格內(nèi)容居中對齊選項(xiàng)

(4)操作功能

  • 預(yù)覽合并:顯示將要執(zhí)行的合并操作信息,但不實(shí)際修改文件
  • 保存文件:處理完成后保存新文件,自動(dòng)添加"_合并后"后綴

2. 核心處理邏輯

(1)表格處理流程

  1. 驗(yàn)證文檔和表格是否存在
  2. 根據(jù)設(shè)置的表頭和表尾行數(shù)確定數(shù)據(jù)行范圍
  3. 對選定的每一列執(zhí)行合并操作

(2)單元格合并實(shí)現(xiàn)

  • 收集指定列中所有單元格的內(nèi)容
  • 識別連續(xù)相同內(nèi)容的單元格范圍
  • 使用python-docxmerge方法合并單元格
  • 對合并后的單元格應(yīng)用統(tǒng)一的格式設(shè)置

(3)格式應(yīng)用

  • 居中對齊
  • 字體大小和加粗設(shè)置

3. 技術(shù)特點(diǎn)

  1. 圖形用戶界面:使用PyQt5構(gòu)建直觀易用的界面
  2. 文檔處理:基于python-docx庫操作Word文檔
  3. 錯(cuò)誤處理:對各種操作提供錯(cuò)誤提示和警告
  4. 非破壞性操作:原始文件保持不變,生成新文件
  5. 靈活性:支持多表格文檔,可自定義表頭表尾行數(shù)

4. 使用場景

  • 需要合并Word表格中相同內(nèi)容的單元格
  • 標(biāo)準(zhǔn)化表格格式(字體、對齊方式等)
  • 批量處理包含多個(gè)相似表格的Word文檔
  • 需要保留表頭和表尾不參與合并的特殊表格

三:完整代碼:

import sys
import os
from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QSpinBox, QComboBox, QCheckBox, QFileDialog, QMessageBox, QGroupBox, QFormLayout)
from docx import Document
from docx.shared import Pt
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
from docx.enum.table import WD_ALIGN_VERTICAL

class WordTableMerger(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("Word表格合并單元格工具")
        self.setGeometry(100, 100, 600, 500)
        self.initUI()

    def initUI(self):
        main_widget = QWidget()
        main_layout = QVBoxLayout()
        file_group = QGroupBox("文件設(shè)置")
        file_layout = QHBoxLayout()
        self.file_label = QLabel("未選擇文件")
        self.file_button = QPushButton("選擇Word文件")
        self.file_button.clicked.connect(self.select_file)
        file_layout.addWidget(self.file_label)
        file_layout.addWidget(self.file_button)
        file_group.setLayout(file_layout)
        table_group = QGroupBox("表格設(shè)置")
        table_layout = QFormLayout()
        self.table_index_spin = QSpinBox()
        self.table_index_spin.setRange(0, 10)
        self.table_index_spin.setValue(0)
        self.header_rows_spin = QSpinBox()
        self.header_rows_spin.setRange(0, 10)
        self.header_rows_spin.setValue(1)
        self.footer_rows_spin = QSpinBox()
        self.footer_rows_spin.setRange(0, 10)
        self.footer_rows_spin.setValue(1)
        table_layout.addRow("表格索引:", self.table_index_spin)
        table_layout.addRow("表頭行數(shù):", self.header_rows_spin)
        table_layout.addRow("表尾行數(shù):", self.footer_rows_spin)
        table_group.setLayout(table_layout)
        merge_group = QGroupBox("合并設(shè)置")
        merge_layout = QVBoxLayout()
        col1_layout = QHBoxLayout()
        col1_layout.addWidget(QLabel("列1索引:"))
        self.col1_spin = QSpinBox()
        self.col1_spin.setRange(0, 20)
        self.col1_spin.setValue(1)
        col1_layout.addWidget(self.col1_spin)
        self.col1_merge = QCheckBox("合并列1")
        self.col1_merge.setChecked(True)
        col1_layout.addWidget(self.col1_merge)
        col2_layout = QHBoxLayout()
        col2_layout.addWidget(QLabel("列2索引:"))
        self.col2_spin = QSpinBox()
        self.col2_spin.setRange(0, 20)
        self.col2_spin.setValue(2)
        col2_layout.addWidget(self.col2_spin)
        self.col2_merge = QCheckBox("合并列2")
        self.col2_merge.setChecked(True)
        col2_layout.addWidget(self.col2_merge)
        font_layout = QHBoxLayout()
        font_layout.addWidget(QLabel("字體大小:"))
        self.font_size_spin = QSpinBox()
        self.font_size_spin.setRange(8, 72)
        self.font_size_spin.setValue(11)
        font_layout.addWidget(self.font_size_spin)
        self.bold_check = QCheckBox("加粗")
        font_layout.addWidget(self.bold_check)
        self.center_check = QCheckBox("居中對齊")
        self.center_check.setChecked(True)
        font_layout.addWidget(self.center_check)
        merge_layout.addLayout(col1_layout)
        merge_layout.addLayout(col2_layout)
        merge_layout.addLayout(font_layout)
        merge_group.setLayout(merge_layout)
        button_layout = QHBoxLayout()
        self.preview_button = QPushButton("預(yù)覽合并")
        self.preview_button.clicked.connect(self.preview_merge)
        self.save_button = QPushButton("保存文件")
        self.save_button.clicked.connect(self.save_file)
        button_layout.addWidget(self.preview_button)
        button_layout.addWidget(self.save_button)
        main_layout.addWidget(file_group)
        main_layout.addWidget(table_group)
        main_layout.addWidget(merge_group)
        main_layout.addLayout(button_layout)
        main_widget.setLayout(main_layout)
        self.setCentralWidget(main_widget)
        self.doc = None
        self.file_path = ""

    def select_file(self):
        options = QFileDialog.Options()
        file_path, _ = QFileDialog.getOpenFileName(
            self, "選擇Word文件", "",
            "Word文件 (*.docx);;所有文件 (*)",
            options=options
        )

        if file_path:
            self.file_path = file_path
            self.file_label.setText(file_path.split("/")[-1])
            try:
                self.doc = Document(file_path)
                QMessageBox.information(self, "成功", "文件加載成功!")
            except Exception as e:
                QMessageBox.critical(self, "錯(cuò)誤", f"無法加載文件:\n{str(e)}")

    def merge_cells(self, table, col_index, start_row, end_row):
        if start_row >= end_row:
            return

        cells_info = []
        for row_idx in range(start_row, end_row):
            cell = table.cell(row_idx, col_index)
            text = self.get_cell_text(cell)
            cells_info.append((row_idx, text, cell))

        if not cells_info:
            return

        current_value = cells_info[0][1]
        merge_start = start_row
        last_value = current_value

        for i in range(1, len(cells_info)):
            row_idx, text, cell = cells_info[i]
            if text != current_value:
                if merge_start < row_idx - 1:
                    self.merge_and_format(table, col_index, merge_start, row_idx - 1, last_value)
                else:
                    self.apply_cell_format(table.cell(merge_start, col_index))

                current_value = text
                merge_start = row_idx
            last_value = text

        last_row = end_row - 1
        if merge_start < last_row:
            self.merge_and_format(table, col_index, merge_start, last_row, last_value)
        else:
            self.apply_cell_format(table.cell(merge_start, col_index))

    def merge_and_format(self, table, col_index, start_row, end_row, value):
        merged_cell = table.cell(start_row, col_index).merge(table.cell(end_row, col_index))
        merged_cell.text = ""
        paragraph = merged_cell.paragraphs[0]
        run = paragraph.add_run(value)
        self.apply_cell_format(merged_cell)

    def get_cell_text(self, cell):
        text_parts = []
        for paragraph in cell.paragraphs:
            text_parts.append(paragraph.text.strip())
        return " ".join(text_parts).strip()

    def apply_cell_format(self, cell):
        cell.vertical_alignment = WD_ALIGN_VERTICAL.CENTER

        if not cell.paragraphs:
            cell.add_paragraph()

        paragraph = cell.paragraphs[0]

        if self.center_check.isChecked():
            paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
        else:
            paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.LEFT

        text = self.get_cell_text(cell)
        paragraph.clear()
        run = paragraph.add_run(text)
        run.font.size = Pt(self.font_size_spin.value())
        run.bold = self.bold_check.isChecked()

    def process_table(self, preview_mode=False):
        if not self.doc:
            QMessageBox.warning(self, "警告", "請先選擇Word文件!")
            return False

        try:
            table_index = self.table_index_spin.value()
            if table_index >= len(self.doc.tables):
                QMessageBox.warning(self, "警告", f"文檔中只有 {len(self.doc.tables)} 個(gè)表格!")
                return False

            table = self.doc.tables[table_index]
            header_rows = self.header_rows_spin.value()
            footer_rows = self.footer_rows_spin.value()

            if len(table.rows) <= header_rows + footer_rows:
                QMessageBox.warning(self, "警告", "表格行數(shù)不足!")
                return False

            start_row = header_rows
            end_row = len(table.rows) - footer_rows

            if preview_mode:
                info = "將要執(zhí)行以下合并操作:\n"
                if self.col1_merge.isChecked():
                    info += f"- 列 {self.col1_spin.value()} 將合并相同內(nèi)容的單元格\n"
                if self.col2_merge.isChecked():
                    info += f"- 列 {self.col2_spin.value()} 將合并相同內(nèi)容的單元格\n"
                info += f"\n表格索引: {table_index}\n"
                info += f"數(shù)據(jù)行范圍: 行 {start_row + 1} 到行 {end_row} (共 {end_row - start_row} 行)\n"
                info += f"表頭行數(shù): {header_rows}\n"
                info += f"表尾行數(shù): {footer_rows}"

                QMessageBox.information(self, "預(yù)覽", info)
                return True

            if self.col1_merge.isChecked():
                self.merge_cells(table, self.col1_spin.value(), start_row, end_row)
            if self.col2_merge.isChecked():
                self.merge_cells(table, self.col2_spin.value(), start_row, end_row)

            return True

        except Exception as e:
            QMessageBox.critical(self, "錯(cuò)誤", f"處理表格時(shí)出錯(cuò):\n{str(e)}")
            return False

    def preview_merge(self):
        self.process_table(preview_mode=True)

    def save_file(self):
        if not self.process_table():
            return

        if not self.file_path:
            QMessageBox.warning(self, "警告", "沒有原始文件路徑!")
            return

        try:
            path, filename = os.path.split(self.file_path)
            name, ext = os.path.splitext(filename)
            new_filename = f"{name}_合并后{ext}"
            new_path = os.path.join(path, new_filename)

            if os.path.exists(new_path):
                reply = QMessageBox.question(
                    self, "文件已存在",
                    f"文件 {new_filename} 已存在,是否覆蓋?",
                    QMessageBox.Yes | QMessageBox.No
                )
                if reply == QMessageBox.No:
                    return

            self.doc.save(new_path)
            QMessageBox.information(self, "成功", f"文件已保存為:\n{new_filename}")

        except Exception as e:
            QMessageBox.critical(self, "錯(cuò)誤", f"保存文件時(shí)出錯(cuò):\n{str(e)}")

if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = WordTableMerger()
    window.show()
    sys.exit(app.exec_())

四:代碼分析:

1. 用戶界面初始化

def initUI(self):
    # 創(chuàng)建主部件和布局
    main_widget = QWidget()
    main_layout = QVBoxLayout()
    
    # 文件選擇區(qū)域
    # 使用QGroupBox和布局管理器組織界面元素
    file_group = QGroupBox("文件設(shè)置")
    file_layout = QHBoxLayout()
    self.file_label = QLabel("未選擇文件")
    self.file_button = QPushButton("選擇Word文件")
    self.file_button.clicked.connect(self.select_file)
    file_layout.addWidget(self.file_label)
    file_layout.addWidget(self.file_button)
    file_group.setLayout(file_layout)
    
    # 表格設(shè)置區(qū)域
    table_group = QGroupBox("表格設(shè)置")
    table_layout = QFormLayout()
    self.table_index_spin = QSpinBox()
    self.table_index_spin.setRange(0, 10)
    self.table_index_spin.setValue(0)
    self.header_rows_spin = QSpinBox()
    self.header_rows_spin.setRange(0, 10)
    self.header_rows_spin.setValue(1)
    self.footer_rows_spin = QSpinBox()
    self.footer_rows_spin.setRange(0, 10)
    self.footer_rows_spin.setValue(1)
    table_layout.addRow("表格索引:", self.table_index_spin)
    table_layout.addRow("表頭行數(shù):", self.header_rows_spin)
    table_layout.addRow("表尾行數(shù):", self.footer_rows_spin)
    table_group.setLayout(table_layout)
    
    # 合并設(shè)置區(qū)域
    merge_group = QGroupBox("合并設(shè)置")
    merge_layout = QVBoxLayout()
    
    # 列1設(shè)置
    col1_layout = QHBoxLayout()
    col1_layout.addWidget(QLabel("列1索引:"))
    self.col1_spin = QSpinBox()
    self.col1_spin.setRange(0, 20)
    self.col1_spin.setValue(1)
    col1_layout.addWidget(self.col1_spin)
    self.col1_merge = QCheckBox("合并列1")
    self.col1_merge.setChecked(True)
    col1_layout.addWidget(self.col1_merge)
    
    # 列2設(shè)置
    col2_layout = QHBoxLayout()
    col2_layout.addWidget(QLabel("列2索引:"))
    self.col2_spin = QSpinBox()
    self.col2_spin.setRange(0, 20)
    self.col2_spin.setValue(2)
    col2_layout.addWidget(self.col2_spin)
    self.col2_merge = QCheckBox("合并列2")
    self.col2_merge.setChecked(True)
    col2_layout.addWidget(self.col2_merge)
    
    # 字體和對齊設(shè)置
    font_layout = QHBoxLayout()
    font_layout.addWidget(QLabel("字體大小:"))
    self.font_size_spin = QSpinBox()
    self.font_size_spin.setRange(8, 72)
    self.font_size_spin.setValue(11)
    font_layout.addWidget(self.font_size_spin)
    self.bold_check = QCheckBox("加粗")
    font_layout.addWidget(self.bold_check)
    self.center_check = QCheckBox("居中對齊")
    self.center_check.setChecked(True)
    font_layout.addWidget(self.center_check)
    
    merge_layout.addLayout(col1_layout)
    merge_layout.addLayout(col2_layout)
    merge_layout.addLayout(font_layout)
    merge_group.setLayout(merge_layout)
    
    # 按鈕區(qū)域
    button_layout = QHBoxLayout()
    self.preview_button = QPushButton("預(yù)覽合并")
    self.preview_button.clicked.connect(self.preview_merge)
    self.save_button = QPushButton("保存文件")
    self.save_button.clicked.connect(self.save_file)
    button_layout.addWidget(self.preview_button)
    button_layout.addWidget(self.save_button)
    
    # 組裝主界面
    main_layout.addWidget(file_group)
    main_layout.addWidget(table_group)
    main_layout.addWidget(merge_group)
    main_layout.addLayout(button_layout)
    main_widget.setLayout(main_layout)
    self.setCentralWidget(main_widget)
    
    # 初始化文檔變量
    self.doc = None
    self.file_path = ""

2. 文件選擇功能

def select_file(self):
    # 使用QFileDialog打開文件選擇對話框
    options = QFileDialog.Options()
    file_path, _ = QFileDialog.getOpenFileName(
        # 限制文件類型為.docx或所有文件
        self, "選擇Word文件", "",
        "Word文件 (*.docx);;所有文件 (*)",
        options=options
    )

    if file_path:
        self.file_path = file_path
        self.file_label.setText(file_path.split("/")[-1])
        try:
            self.doc = Document(file_path)
            QMessageBox.information(self, "成功", "文件加載成功!")
        except Exception as e:
            QMessageBox.critical(self, "錯(cuò)誤", f"無法加載文件:\n{str(e)}")

3. 單元格合并核心功能

def merge_cells(self, table, col_index, start_row, end_row):
    if start_row >= end_row:
        return

    # 收集單元格信息
    cells_info = []
    for row_idx in range(start_row, end_row):
        cell = table.cell(row_idx, col_index)
        text = self.get_cell_text(cell)
        cells_info.append((row_idx, text, cell))

    if not cells_info:
        return

    # 合并相同內(nèi)容的單元格
    current_value = cells_info[0][1]
    merge_start = start_row
    last_value = current_value

    for i in range(1, len(cells_info)):
        row_idx, text, cell = cells_info[i]
        if text != current_value:
            if merge_start < row_idx - 1:
                self.merge_and_format(table, col_index, merge_start, row_idx - 1, last_value)
            else:
                self.apply_cell_format(table.cell(merge_start, col_index))

            current_value = text
            merge_start = row_idx
        last_value = text

    # 處理最后一組單元格
    last_row = end_row - 1
    if merge_start < last_row:
        self.merge_and_format(table, col_index, merge_start, last_row, last_value)
    else:
        self.apply_cell_format(table.cell(merge_start, col_index))

def merge_and_format(self, table, col_index, start_row, end_row, value):
    # 執(zhí)行單元格合并
    merged_cell = table.cell(start_row, col_index).merge(table.cell(end_row, col_index))
    merged_cell.text = ""
    paragraph = merged_cell.paragraphs[0]
    run = paragraph.add_run(value)
    self.apply_cell_format(merged_cell)

def get_cell_text(self, cell):
    # 獲取單元格文本(合并所有段落)
    text_parts = []
    for paragraph in cell.paragraphs:
        text_parts.append(paragraph.text.strip())
    return " ".join(text_parts).strip()

4. 單元格格式設(shè)置

def apply_cell_format(self, cell):
    # 設(shè)置垂直對齊方式
    cell.vertical_alignment = WD_ALIGN_VERTICAL.CENTER

    # 確保有段落
    if not cell.paragraphs:
        cell.add_paragraph()

    paragraph = cell.paragraphs[0]

    # 設(shè)置水平對齊方式
    if self.center_check.isChecked():
        paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
    else:
        paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.LEFT

    # 設(shè)置字體格式
    text = self.get_cell_text(cell)
    paragraph.clear()
    run = paragraph.add_run(text)
    run.font.size = Pt(self.font_size_spin.value())
    run.bold = self.bold_check.isChecked()

5. 表格處理功能

def process_table(self, preview_mode=False):
    if not self.doc:
        QMessageBox.warning(self, "警告", "請先選擇Word文件!")
        return False

    try:
        # 獲取表格索引并驗(yàn)證
        table_index = self.table_index_spin.value()
        if table_index >= len(self.doc.tables):
            QMessageBox.warning(self, "警告", f"文檔中只有 {len(self.doc.tables)} 個(gè)表格!")
            return False

        table = self.doc.tables[table_index]
        header_rows = self.header_rows_spin.value()
        footer_rows = self.footer_rows_spin.value()

        # 驗(yàn)證表格行數(shù)
        if len(table.rows) <= header_rows + footer_rows:
            QMessageBox.warning(self, "警告", "表格行數(shù)不足!")
            return False

        # 計(jì)算數(shù)據(jù)行范圍
        start_row = header_rows
        end_row = len(table.rows) - footer_rows

        # 預(yù)覽模式只顯示信息
        if preview_mode:
            info = "將要執(zhí)行以下合并操作:\n"
            if self.col1_merge.isChecked():
                info += f"- 列 {self.col1_spin.value()} 將合并相同內(nèi)容的單元格\n"
            if self.col2_merge.isChecked():
                info += f"- 列 {self.col2_spin.value()} 將合并相同內(nèi)容的單元格\n"
            info += f"\n表格索引: {table_index}\n"
            info += f"數(shù)據(jù)行范圍: 行 {start_row + 1} 到行 {end_row} (共 {end_row - start_row} 行)\n"
            info += f"表頭行數(shù): {header_rows}\n"
            info += f"表尾行數(shù): {footer_rows}"

            QMessageBox.information(self, "預(yù)覽", info)
            return True

        # 實(shí)際執(zhí)行合并
        if self.col1_merge.isChecked():
            self.merge_cells(table, self.col1_spin.value(), start_row, end_row)
        if self.col2_merge.isChecked():
            self.merge_cells(table, self.col2_spin.value(), start_row, end_row)

        return True

    except Exception as e:
        QMessageBox.critical(self, "錯(cuò)誤", f"處理表格時(shí)出錯(cuò):\n{str(e)}")
        return False

6. 預(yù)覽和保存功能

def preview_merge(self):
    self.process_table(preview_mode=True)

def save_file(self):
    if not self.process_table():
        return

    if not self.file_path:
        QMessageBox.warning(self, "警告", "沒有原始文件路徑!")
        return

    try:
        # 生成新文件名
        path, filename = os.path.split(self.file_path)
        name, ext = os.path.splitext(filename)
        new_filename = f"{name}_合并后{ext}"
        new_path = os.path.join(path, new_filename)

        # 檢查文件是否已存在
        if os.path.exists(new_path):
            reply = QMessageBox.question(
                self, "文件已存在",
                f"文件 {new_filename} 已存在,是否覆蓋?",
                QMessageBox.Yes | QMessageBox.No
            )
            if reply == QMessageBox.No:
                return

        # 保存文件
        self.doc.save(new_path)
        QMessageBox.information(self, "成功", f"文件已保存為:\n{new_filename}")

    except Exception as e:
        QMessageBox.critical(self, "錯(cuò)誤", f"保存文件時(shí)出錯(cuò):\n{str(e)}")

以上就是基于Python實(shí)現(xiàn)一個(gè)Word表格合并單元格工具的詳細(xì)內(nèi)容,更多關(guān)于Python Word表格合并單元格的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Python for i in range ()用法詳解

    Python for i in range ()用法詳解

    今天小編就為大家分享一篇Python for i in range ()用法詳解,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-12-12
  • 使用Python打造一個(gè)完美的程序打包工具

    使用Python打造一個(gè)完美的程序打包工具

    在Python開發(fā)的世界里,程序打包一直是一個(gè)讓開發(fā)者頭疼的問題,本文將和大家分享一個(gè)功能完備的Python程序打包器,它不僅解決了打包問題,更是一個(gè)完整的Python環(huán)境管理解決方案,感興趣的小伙伴可以了解下
    2025-10-10
  • 基于python opencv單目相機(jī)標(biāo)定的示例代碼

    基于python opencv單目相機(jī)標(biāo)定的示例代碼

    這篇文章主要介紹了基于python opencv單目相機(jī)標(biāo)定的實(shí)現(xiàn)代碼,代碼簡單易懂,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-01-01
  • pytorch tensorboard可視化的使用詳解

    pytorch tensorboard可視化的使用詳解

    tensorboard是tensorflow用來可視化訓(xùn)練和測試過程的模塊,而pytorch并沒有可視化模塊,但是pytoch=1.2.0版本以上開始支持tensorboard
    2022-10-10
  • django之導(dǎo)入并執(zhí)行自定義的函數(shù)模塊圖解

    django之導(dǎo)入并執(zhí)行自定義的函數(shù)模塊圖解

    這篇文章主要介紹了django之導(dǎo)入并執(zhí)行自定義的函數(shù)模塊圖解,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-04-04
  • Python Pyqt5多線程更新UI代碼實(shí)例(防止界面卡死)

    Python Pyqt5多線程更新UI代碼實(shí)例(防止界面卡死)

    這篇文章通過代碼實(shí)例給大家介紹了Python Pyqt5多線程更新UI防止界面卡死的問題,代碼簡單易懂,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2021-12-12
  • 淺談Python3中datetime不同時(shí)區(qū)轉(zhuǎn)換介紹與踩坑

    淺談Python3中datetime不同時(shí)區(qū)轉(zhuǎn)換介紹與踩坑

    最近的項(xiàng)目需要根據(jù)用戶所屬時(shí)區(qū)制定一些特定策略,學(xué)習(xí)、應(yīng)用了若干python3的時(shí)區(qū)轉(zhuǎn)換相關(guān)知識,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-08-08
  • PyQt5頁面跳轉(zhuǎn)問題及解決方式

    PyQt5頁面跳轉(zhuǎn)問題及解決方式

    本文主要介紹了PyQt5頁面跳轉(zhuǎn)問題及解決方式,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-01-01
  • Python自動(dòng)化之pynput鍵盤鼠標(biāo)操作全攻略

    Python自動(dòng)化之pynput鍵盤鼠標(biāo)操作全攻略

    這篇文章主要為大家詳細(xì)介紹了Python如何使用pynput實(shí)現(xiàn)鍵盤鼠標(biāo)的自動(dòng)化操作,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2025-05-05
  • Python如何安裝第三方模塊

    Python如何安裝第三方模塊

    在本篇文章里,小編給大家分享的是關(guān)于Python安裝第三方模塊的方法及實(shí)例代碼,需要的朋友們可以學(xué)習(xí)下。
    2020-05-05

最新評論

平利县| 本溪市| 台南市| 汝阳县| 武夷山市| 武汉市| 邛崃市| 法库县| 手游| 肥东县| 宣汉县| 兴文县| 陇西县| 许昌县| 石渠县| 化隆| 含山县| 八宿县| 迁安市| 五原县| 长葛市| 玛曲县| 禄劝| 台北市| 托克逊县| 安化县| 察隅县| 吉木乃县| 汉沽区| 宁晋县| 玛纳斯县| 白山市| 承德县| 仁布县| 新宾| 凭祥市| 琼海市| 郑州市| 永康市| 观塘区| 比如县|