Python操作Excel:从基础到高级的深度实践
off999 2025-09-09 09:20 104 浏览 0 评论
Python凭借其丰富的库生态系统,已成为自动化处理Excel数据的强大工具。本文将深入探讨五个关键领域,通过实际代码示例展示如何利用Python进行高效的Excel操作,涵盖数据处理、格式控制、可视化、宏集成以及性能优化。
1. 高效数据清洗与预处理
数据清洗是数据分析的基础环节,Python的pandas库提供了强大而灵活的数据清洗功能,能够高效处理缺失值、重复数据和类型不一致等问题。
实例:销售数据清洗与转换
import pandas as pd import numpy as np from datetime import datetime # 读取Excel文件 sales_data = pd.read_excel('sales_data.xlsx', sheet_name='RawData') # 处理缺失值:数值列用0填充,分类列用'Unknown'填充 numeric_cols = ['sales_volume', 'sales_amount'] categorical_cols = ['product_category', 'region'] sales_data[numeric_cols] = sales_data[numeric_cols].fillna(0) sales_data[categorical_cols] = sales_data[categorical_cols].fillna('Unknown') # 删除完全重复的行
sales_data.drop_duplicates(inplace=True) # 处理异常值:使用IQR方法识别和处理异常值 Q1 = sales_data['sales_amount'].quantile(0.25) Q3 = sales_data['sales_amount'].quantile(0.75) IQR = Q3 - Q1 lower_bound = Q1 - 1.5 * IQR upper_bound = Q3 + 1.5 * IQR sales_data = sales_data[(sales_data['sales_amount'] >= lower_bound) & (sales_data['sales_amount'] <= upper_bound)] # 数据类型转换和格式化 sales_data['sale_date'] = pd.to_datetime(sales_data['sale_date'], format='%Y-%m-%d') sales_data['month'] = sales_data['sale_date'].dt.to_period('M') sales_data['sales_id'] = sales_data['sales_id'].astype('string') # 创建数据质量报告 data_quality_report = pd.DataFrame({ 'column_name': sales_data.columns, 'data_type': sales_data.dtypes.values, 'missing_values': sales_data.isnull().sum().values, 'unique_values': sales_data.nunique().values }) # 保存清洗后的数据和报告 with pd.ExcelWriter('cleaned_sales_data.xlsx') as writer: sales_data.to_excel(writer, sheet_name='CleanedData', index=False)
data_quality_report.to_excel(writer, sheet_name='DataQualityReport', index=False) print("数据清洗完成!已保存清洗后的数据和数据质量报告。")
这段代码展示了专业级的数据清洗流程,包括缺失值处理、异常值检测、数据类型转换和数据质量报告生成。数据质量报告可以帮助分析人员了解数据的基本情况和清洗效果。
2. 高级单元格格式控制与样式管理
openpyxl库提供了对Excel单元格格式的精细控制能力,可以创建专业外观的报表和仪表板。
实例:创建格式化的财务报表
from openpyxl import Workbook from openpyxl.styles import Font, PatternFill, Border, Side, Alignment, NamedStyle from openpyxl.utils import get_column_letter from openpyxl.chart import BarChart, Reference import datetime # 创建 workbook 和工作表 wb = Workbook() ws = wb.active ws.title = "财务报告" # 示例数据 financial_data = [ ['季度', '收入', '支出', '利润'], ['Q1 2023', 100000, 70000, 30000], ['Q2 2023', 120000, 80000, 40000], ['Q3 2023', 150000, 90000, 60000], ['Q4 2023', 180000, 100000, 80000], ['总计', 550000, 340000, 210000] ] # 定义样式 header_style = NamedStyle(name="header_style") header_style.font = Font(bold=True, color="FFFFFF", size=12) header_style.fill = PatternFill(start_color="366092", end_color="366092", fill_type="solid") header_style.border = Border(bottom=Side(border_style="thin")) header_style.alignment = Alignment(horizontal="center", vertical="center") currency_style = NamedStyle(name="currency_style")
currency_style.number_format = '"yen"#,##0.00_);("yen"#,##0.00)' currency_style.alignment = Alignment(horizontal="right") # 添加数据到工作表 for row_idx, row_data in enumerate(financial_data, 1): for col_idx, cell_value in enumerate(row_data, 1): cell = ws.cell(row=row_idx, column=col_idx, value=cell_value) # 应用标题样式 if row_idx == 1: cell.style = header_style # 应用货币格式到数值单元格 elif isinstance(cell_value, (int, float)) and col_idx > 1: cell.style = currency_style # 设置列宽 column_widths = [15, 15, 15, 15] for col_idx, width in enumerate(column_widths, 1): ws.column_dimensions[get_column_letter(col_idx)].width = width # 添加边框到数据区域 thin_border = Border(left=Side(style='thin'), right=Side(style='thin'), top=Side(style='thin'), bottom=Side(style='thin')) for row in ws[1:len(financial_data)]: for cell in row: cell.border = thin_border # 创建图表 chart = BarChart() chart.type = "col" chart.style = 10 chart.title = "季度财务表现" chart.y_axis.title = "金额 (yen)" chart.x_axis.title = "季度" data = Reference(ws, min_col=2, min_row=1, max_col=4, max_row=5) categories = Reference(ws, min_col=1, min_row=2, max_row=5) chart.add_data(data, titles_from_data=True) chart.set_categories(categories) ws.add_chart(chart, "F2") # 添加元数据 ws['A8'] = "报告生成时间:" ws['B8'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M") ws['B8'].style = NamedStyle(name="date_style", number_format='YYYY-MM-DD HH:MM') wb.save("
formatted_financial_report.xlsx") print("格式化财务报表已生成!")
此代码创建了一个具有专业外观的财务报表,包含了条件格式化、自定义数字格式、单元格边框和样式、自动列宽调整以及图表集成。这种精细的格式控制对于创建商业级报表至关重要。
3. 多文件数据聚合与自动化报告系统
在企业环境中,经常需要从多个Excel文件中提取、转换和聚合数据,然后生成综合报告。
实例:多部门销售数据聚合系统
import pandas as pd import glob import os from openpyxl import load_workbook from openpyxl.styles import Font import datetime def
create_consolidated_report(input_pattern, output_file): """ 从多个Excel文件合并数据并生成综合报告 """ # 查找所有匹配的Excel文件 file_list = glob.glob(input_pattern) if not file_list: print("未找到匹配的文件!") return all_departments_data = [] # 处理每个文件 for file_path in file_list: try: # 从文件名提取部门名称 department = os.path.basename(file_path).split('_')[0] # 读取Excel文件的所有工作表 excel_file = pd.ExcelFile(file_path) # 处理每个工作表 for sheet_name in excel_file.sheet_names: df = pd.read_excel(file_path, sheet_name=sheet_name) # 添加部门标识和时间戳 df['department'] = department df['report_date'] = pd.to_datetime('today').normalize() df['source_file'] = os.path.basename(file_path)
all_departments_data.append(df) except Exception as e: print(f"处理文件 {file_path} 时出错: {str(e)}") continue if not all_departments_data: print("没有有效数据可处理!") return # 合并所有数据 consolidated_df = pd.concat(all_departments_data, ignore_index=True) # 创建数据透视表摘要 summary_pivot = pd.pivot_table(consolidated_df, values='sales_amount', index=['department'], columns=consolidated_df['sale_date'].dt.month, aggfunc='sum', fill_value=0) # 计算总计和排名 summary_pivot['年度总计'] = summary_pivot.sum(axis=1) summary_pivot['排名'] = summary_pivot['年度总计'].rank(ascending=False).astype(int) # 使用ExcelWriter创建多工作表报告 with pd.ExcelWriter(output_file, engine='openpyxl') as writer: # 保存详细数据 consolidated_df.to_excel(writer, sheet_name='详细数据', index=False) # 保存摘要数据 summary_pivot.to_excel(writer, sheet_name='部门摘要') # 创建月度趋势工作表 monthly_trends = consolidated_df.groupby( consolidated_df['sale_date'].dt.to_period('M') )['sales_amount'].agg(['sum', 'mean', 'count']).round(2) monthly_trends.to_excel(writer, sheet_name='月度趋势') # 获取工作簿对象进行格式设置 workbook = writer.book worksheet = writer.sheets['详细数据'] # 设置标题样式 for col_num, value in enumerate(
consolidated_df.columns.values): worksheet.cell(1, col_num + 1).font = Font(bold=True) # 添加自定义格式 format_final_report(output_file) print(f"综合报告已生成: {output_file}") return consolidated_df, summary_pivot def format_final_report(file_path): """应用最终格式到报告""" wb = load_workbook(file_path) # 格式化详细数据工作表 if '详细数据' in wb.sheetnames: ws = wb['详细数据'] # 设置列宽 column_widths = { 'A': 12, 'B': 15, 'C': 20, 'D': 15, 'E': 15, 'F': 12, 'G': 15, 'H': 20 } for col_letter, width in column_widths.items(): ws.column_dimensions[col_letter].width = width wb.save(file_path) # 使用示例 if __name__ == "__main__": input_pattern = "department_*.xlsx" # 匹配部门文件 output_file = f"
consolidated_sales_report_{datetime.date.today()}.xlsx" consolidated_data, summary =
create_consolidated_report(input_pattern, output_file)
这个高级示例展示了如何从多个部门文件中提取数据,进行跨工作表的聚合分析,创建数据透视表,并生成具有多工作表的综合报告。系统还包括错误处理、数据追踪和自动格式设置。
4. Excel与Python的宏和VBA集成
通过xlwings库,Python可以与Excel的VBA宏进行深度集成,实现更复杂的自动化任务。
实例:Python驱动Excel宏执行系统
import xlwings as xw import pandas as pd import pythoncom import win32com.client as win32 import time class ExcelMacroAutomation: def __init__(self, excel_file_path): self.excel_file_path = excel_file_path self.app = None self.wb = None def connect_to_excel(self, visible=False): """连接到Excel应用程序""" try: # 确保COM线程初始化 pythoncom.CoInitialize() # 尝试连接到现有Excel实例,或创建新实例 try: self.app = xw.App(visible=visible) except Exception: self.app = win32.Dispatch("Excel.Application") self.app.Visible = visible # 打开工作簿 self.wb = self.app.books.open(self.excel_file_path) print(f"成功连接到Excel和工作簿: {self.excel_file_path}") return True except Exception as e: print(f"连接Excel时出错: {str(e)}") return False def run_macro(self, macro_name, *args): """运行VBA宏""" try: if hasattr(self.app, 'macros'): # 使用xlwings方式运行宏 macro = self.app.macros[macro_name] result = macro(*args) else: # 使用win32com方式运行宏 result = self.app.Application.Run( f"'{self.wb.name}'!{macro_name}", *args ) print(f"宏 {macro_name} 执行成功") return result except Exception as e: print(f"执行宏 {macro_name} 时出错: {str(e)}") return None def create_macro(self, macro_code, macro_name): """动态创建VBA宏""" try: # 创建VBA模块 vba_module =
self.wb.api.VBProject.VBComponents.Add(1) # 1 = vbext_ct_StdModule # 添加宏代码
vba_module.CodeModule.AddFromString(macro_code) print(f"宏 {macro_name} 创建成功") return True except Exception as e: print(f"创建宏时出错: {str(e)}") # 可能需要启用对VBA项目对象的访问信任 return False def
python_to_vba_data_exchange(self, data_dict, range_address="A1"): """在Python和VBA之间交换数据""" try: # 将Python数据写入Excel范围 sheet = self.wb.sheets[0] # 写入字典数据 for i, (key, value) in enumerate(data_dict.items()): sheet.range(f"A{i+1}").value = key sheet.range(f"B{i+1}").value = value # 运行处理数据的宏 self.run_macro("ProcessPythonData") # 读取处理后的数据 result_range = sheet.range("C1").expand('down') processed_data = result_range.value return processed_data except Exception as e: print(f"数据交换时出错: {str(e)}") return None def
generate_report_with_macros(self, output_file): """使用宏生成高级报告""" try: # 运行数据准备宏 self.run_macro("PrepareDataForReport") # 运行图表生成宏 self.run_macro("GenerateCharts") # 运行格式设置宏 self.run_macro("FormatReport") # 保存报告 self.wb.save_as(output_file) print(f"报告已生成: {output_file}") return True except Exception as e: print(f"生成报告时出错: {str(e)}") return False def close(self, save_changes=True): """关闭连接""" try: if hasattr(self, 'wb') and self.wb: if save_changes: self.wb.save() self.wb.close() if hasattr(self, 'app') and self.app: self.app.quit() pythoncom.CoUninitialize() print("Excel连接已关闭") except Exception as e: print(f"关闭连接时出错: {str(e)}") # 示例使用 if __name__ == "__main__": # 示例VBA宏代码 vba_code = """ Sub ProcessPythonData() Dim rng As Range Set rng = ThisWorkbook.Sheets(1).Range("A1").CurrentRegion For i = 1 To rng.Rows.Count ' 处理数据示例:将B列值加倍并放入C列 ThisWorkbook.Sheets(1).Cells(i, 3).Value = ThisWorkbook.Sheets(1).Cells(i, 2).Value * 2 Next i End Sub Sub GenerateCharts() ' 生成图表示例代码 Dim chart As Chart Set chart = ThisWorkbook.Sheets(1).Shapes.AddChart2(201, xlColumnClustered).Chart chart.SetSourceData Source:=ThisWorkbook.Sheets(1).Range("A1").CurrentRegion chart.HasTitle = True chart.ChartTitle.Text = "数据处理结果" End Sub """ # 创建自动化实例 excel_automation = ExcelMacroAutomation("data_source.xlsx") if
excel_automation.connect_to_excel(visible=True): try: # 创建新宏
excel_automation.create_macro(vba_code, "ProcessPythonData") # 准备测试数据 test_data = {"Apple": 100, "Banana": 150, "Orange": 200, "Grape": 90} # 执行数据交换和处理 processed_data =
excel_automation.python_to_vba_data_exchange(test_data) print(f"处理后的数据: {processed_data}") # 生成完整报告
excel_automation.generate_report_with_macros("final_report.xlsx") finally: excel_automation.close()
这个实例展示了Python与Excel VBA的深度集成,包括动态创建宏、执行现有宏、在Python和VBA之间交换数据以及协调两者完成复杂任务。
5. 大规模数据处理与性能优化
处理大型Excel文件时,性能成为关键考虑因素。以下示例展示了如何优化内存使用和处理速度。
实例:高效处理大型Excel数据集
import pandas as pd import numpy as np from openpyxl import load_workbook from openpyxl.utils.dataframe import dataframe_to_rows import time import psutil import os class LargeExcelProcessor: def __init__(self, file_path): self.file_path = file_path self.chunk_size = 10000 # 默认块大小 def set_chunk_size(self, chunk_size): """设置处理块大小""" self.chunk_size = chunk_size def get_memory_usage(self): """获取当前内存使用情况""" process = psutil.Process(os.getpid()) return process.memory_info().rss / 1024 / 1024 # 返回MB def
process_large_file_chunked(self, output_file, processing_callback=None): """ 分块处理大型Excel文件 """ start_time = time.time() initial_memory = self.get_memory_usage() try: # 使用chunksize参数分块读取 chunk_reader = pd.read_excel(self.file_path, chunksize=self.chunk_size) # 创建新工作簿 from openpyxl import Workbook wb = Workbook() ws = wb.active ws.title = "处理后的数据" header_written = False processed_rows = 0 for chunk_idx, chunk in enumerate(chunk_reader): chunk_start_time = time.time() # 处理块数据(应用自定义处理函数) if processing_callback: processed_chunk = processing_callback(chunk) else: processed_chunk = self.default_processing(chunk) # 写入块数据 if not header_written: # 写入标题行 header =
processed_chunk.columns.tolist() ws.append(header) header_written = True # 写入数据行 for row in dataframe_to_rows(processed_chunk, index=False, header=False): ws.append(row) processed_rows += len(processed_chunk) chunk_time = time.time() - chunk_start_time # 打印进度信息 current_memory = self.get_memory_usage() print(f"处理块 {chunk_idx + 1}: {len(processed_chunk)} 行, " f"耗时: {chunk_time:.2f}秒, " f"内存使用: {current_memory:.2f}MB") # 手动内存管理 del chunk del processed_chunk # 保存工作簿 wb.save(output_file) total_time = time.time() - start_time final_memory = self.get_memory_usage() memory_increase = final_memory - initial_memory print(f"\n处理完成! " f"总行数: {processed_rows}, " f"总时间: {total_time:.2f}秒, " f"内存增加: {memory_increase:.2f}MB") return True except Exception as e: print(f"处理文件时出错: {str(e)}") return False def default_processing(self, chunk): """默认数据处理函数""" # 示例处理:数值列标准化 numeric_cols = chunk.select_dtypes(include=[np.number]).columns for col in numeric_cols: if chunk[col].std() > 0: # 避免除零 chunk[col] = (chunk[col] - chunk[col].mean()) / chunk[col].std() return chunk def parallel_processing(self, output_file, num_processes=4): """ 使用多进程并行处理Excel文件 """ import multiprocessing as mp from concurrent.futures import ProcessPoolExecutor # 首先获取总行数来划分任务 total_rows = self.get_row_count() rows_per_process = total_rows // num_processes print(f"开始并行处理: {total_rows} 行, {num_processes} 个进程") # 创建进程池 with ProcessPoolExecutor(max_workers=num_processes) as executor: futures = [] for i in range(num_processes): start_row = i * rows_per_process end_row = start_row + rows_per_process if i < num_processes - 1 else total_rows # 提交处理任务 future = executor.submit( self.process_range, start_row, end_row, f"temp_part_{i}.xlsx" ) futures.append(future) # 等待所有任务完成 results = [] for future in futures: results.append(future.result()) # 合并结果 self.merge_results(output_file, [f"temp_part_{i}.xlsx" for i in range(num_processes)]) # 清理临时文件 for temp_file in [f"temp_part_{i}.xlsx" for i in range(num_processes)]: if os.path.exists(temp_file): os.remove(temp_file) print("并行处理完成!") def get_row_count(self): """获取Excel文件总行数""" wb = load_workbook(self.file_path, read_only=True) ws = wb.active row_count = ws.max_row wb.close() return row_count def process_range(self, start_row, end_row, output_file): """处理指定行范围""" # 实现特定范围的处理逻辑 pass def merge_results(self, output_file, part_files): """合并部分结果文件""" # 实现文件合并逻辑 pass # 高级数据处理函数示例 def advanced_data_processing(chunk): """ 高级数据处理示例:特征工程和异常检测 """ # 创建新特征 numeric_cols = chunk.select_dtypes(include=[np.number]).columns for col in numeric_cols: # 创建移动平均特征 chunk[f'{col}_rolling_mean'] = chunk[col].rolling(window=3, min_periods=1).mean() # 创建差分特征 chunk[f'{col}_diff'] = chunk[col].diff().fillna(0) # 使用隔离森林检测异常值 from sklearn.ensemble import IsolationForest if len(numeric_cols) > 0 and len(chunk) > 10: clf = IsolationForest(contamination=0.05, random_state=42) chunk['anomaly_score'] = clf.fit_predict(chunk[numeric_cols]) return chunk # 使用示例 if __name__ == "__main__": # 创建处理器实例 processor = LargeExcelProcessor("very_large_dataset.xlsx") processor.set_chunk_size(5000) # 设置块大小 # 处理文件(使用自定义处理函数)
processor.process_large_file_chunked( output_file="processed_large_data.xlsx", processing_callback=advanced_data_processing )
这个实例展示了处理大型Excel文件时的多种优化技术,包括分块处理、内存管理、进度监控和并行处理。这些技术对于处理GB级别的Excel文件至关重要。
总结
Python提供了多种强大的库和方法来操作Excel文件,从简单的数据读写到复杂的自动化和集成任务。通过pandas、openpyxl、xlwings等库的组合使用,可以实现:
高效数据清洗和预处理,确保数据质量
精细的格式控制和样式管理,创建专业报表
多文件数据聚合和自动化报告,提高工作效率
Excel与Python的深度集成,包括宏和VBA交互
大规模数据处理和性能优化,应对海量数据挑战
这些深度实例展示了Python在Excel自动化中的强大能力,可以根据具体需求选择合适的方法和工具组合。
相关推荐
- 阿里云国际站ECS:阿里云ECS如何提高网站的访问速度?
-
TG:@yunlaoda360引言:速度即体验,速度即业务在当今数字化的世界中,网站的访问速度已成为决定用户体验、用户留存乃至业务转化率的关键因素。页面加载每延迟一秒,都可能导致用户流失和收入损失。对...
- 高流量大并发Linux TCP性能调优_linux 高并发网络编程
-
其实主要是手里面的跑openvpn服务器。因为并没有明文禁p2p(哎……想想那么多流量好像不跑点p2p也跑不完),所以造成有的时候如果有比较多人跑BT的话,会造成VPN速度急剧下降。本文所面对的情况为...
- 性能测试100集(12)性能指标资源使用率
-
在性能测试中,资源使用率是评估系统硬件效率的关键指标,主要包括以下四类:#性能测试##性能压测策略##软件测试#1.CPU使用率定义:CPU处理任务的时间占比,计算公式为1-空闲时间/总...
- Linux 服务器常见的性能调优_linux高性能服务端编程
-
一、Linux服务器性能调优第一步——先搞懂“看什么”很多人刚接触Linux性能调优时,总想着直接改配置,其实第一步该是“看清楚问题”。就像医生看病要先听诊,调优前得先知道服务器“哪里...
- Nginx性能优化实战:手把手教你提升10倍性能!
-
关注△mikechen△,十余年BAT架构经验倾囊相授!Nginx是大型架构而核心,下面我重点详解Nginx性能@mikechen文章来源:mikechen.cc1.worker_processe...
- 高并发场景下,Spring Cloud Gateway如何抗住百万QPS?
-
关注△mikechen△,十余年BAT架构经验倾囊相授!大家好,我是mikechen。高并发场景下网关作为流量的入口非常重要,下面我重点详解SpringCloudGateway如何抗住百万性能@m...
- Kubernetes 高并发处理实战(可落地案例 + 源码)
-
目标场景:对外提供HTTPAPI的微服务在短时间内收到大量请求(例如每秒数千至数万RPS),要求系统可弹性扩容、限流降级、缓存减压、稳定运行并能自动恢复。总体思路(多层防护):边缘层:云LB...
- 高并发场景下,Nginx如何扛住千万级请求?
-
Nginx是大型架构的必备中间件,下面我重点详解Nginx如何实现高并发@mikechen文章来源:mikechen.cc事件驱动模型Nginx采用事件驱动模型,这是Nginx高并发性能的基石。传统...
- Spring Boot+Vue全栈开发实战,中文版高清PDF资源
-
SpringBoot+Vue全栈开发实战,中文高清PDF资源,需要的可以私我:)SpringBoot致力于简化开发配置并为企业级开发提供一系列非业务性功能,而Vue则采用数据驱动视图的方式将程序...
- Docker-基础操作_docker基础实战教程二
-
一、镜像1、从仓库获取镜像搜索镜像:dockersearchimage_name搜索结果过滤:是否官方:dockersearch--filter="is-offical=true...
- 你有空吗?跟我一起搭个服务器好不好?
-
来人人都是产品经理【起点学院】,BAT实战派产品总监手把手系统带你学产品、学运营。昨天闲的没事的时候,随手翻了翻写过的文章,发现一个很严重的问题。就是大多数时间我都在滔滔不绝的讲理论,却很少有涉及动手...
- 部署你自己的 SaaS_saas如何部署
-
部署你自己的VPNOpenVPN——功能齐全的开源VPN解决方案。(DigitalOcean教程)dockovpn.io—无状态OpenVPNdockerized服务器,不需要持久存储。...
- Docker Compose_dockercompose安装
-
DockerCompose概述DockerCompose是一个用来定义和管理多容器应用的工具,通过一个docker-compose.yml文件,用YAML格式描述服务、网络、卷等内容,...
- 京东T7架构师推出的电子版SpringBoot,从构建小系统到架构大系统
-
前言:Java的各种开发框架发展了很多年,影响了一代又一代的程序员,现在无论是程序员,还是架构师,使用这些开发框架都面临着两方面的挑战。一方面是要快速开发出系统,这就要求使用的开发框架尽量简单,无论...
- Kubernetes (k8s) 入门学习指南_k8s kubeproxy
-
Kubernetes(k8s)入门学习指南一、什么是Kubernetes?为什么需要它?Kubernetes(k8s)是一个开源的容器编排系统,用于自动化部署、扩展和管理容器化应用程序。它...
欢迎 你 发表评论:
- 一周热门
- 最近发表
- 标签列表
-
- python计时 (73)
- python安装路径 (56)
- python类型转换 (93)
- python进度条 (67)
- python吧 (67)
- python的for循环 (65)
- python格式化字符串 (61)
- python静态方法 (57)
- python列表切片 (59)
- python面向对象编程 (60)
- python 代码加密 (65)
- python串口编程 (77)
- python封装 (57)
- python写入txt (66)
- python读取文件夹下所有文件 (59)
- python操作mysql数据库 (66)
- python获取列表的长度 (64)
- python接口 (63)
- python调用函数 (57)
- python多态 (60)
- python匿名函数 (59)
- python打印九九乘法表 (65)
- python赋值 (62)
- python异常 (69)
- python元祖 (57)
