当前位置:首页>python>汇总17个工作必备的Python自动化代码

汇总17个工作必备的Python自动化代码

  • 2026-08-18 23:11:39
汇总17个工作必备的Python自动化代码
关注+星标,每天学习Python新技能

来源:网络

来源丨网络

是否厌倦了在日常工作中做那些重复性的任务?简单但多功能的Python脚本可以解决您的问题。 
我们将通过上下两个篇章为您介绍17个能够自动执行各种任务并提高工作效率Python脚本及其代码。无论您是开发人员、数据分析师,还是只是希望简化工作流程的人,这些脚本都能满足您的需求。

引言

Python是一种流行的编程语言,以其简单性和可读性而闻名。因其能够提供大量的库和模块,它成为了自动化各种任务的绝佳选择。让我们进入自动化的世界,探索17个可以简化工作并节省时间精力的Python脚本。

目录(上篇)

1.自动化文件管理
2.使用Python进行网页抓取
3.文本处理和操作
4.电子邮件自动化
5.自动化Excel电子表格
6.与数据库交互
7.社交媒体自动化
8.自动化系统任务
9.自动化图像编辑

目录(下篇)

10.网络自动化
11.数据清理和转换
12.自动化 PDF 操作
13.自动化GUI
14.自动化测试
15.自动化云服务
16.财务自动化
17.自然语言处理

1.自动化文件管理

1.1 对目录中的文件进行排序

```# Python script to sort files in a directory by their extensionimport osfromshutil import movedef sort_files(directory_path):for filename in os.listdir(directory_path):if os.path.isfile(os.path.join(directory_path, filename)):file_extension = filename.split('.')[-1]destination_directory = os.path.join(directory_path, file_extension)if not os.path.exists(destination_directory):os.makedirs(destination_directory)move(os.path.join(directory_path, filename), os.path.join(destination_directory, filename))```
说明:
此Python脚本根据文件扩展名将文件分类到子目录中,以组织目录中的文件。它识别文件扩展名并将文件移动到适当的子目录。这对于整理下载文件夹或组织特定项目的文件很有用。

1.2 删除空文件夹

```# Python script to remove empty folders in a directoryimport osdefremove_empty_folders(directory_path):for root, dirs, files in os.walk(directory_path, topdown=False):for folder in dirs:folder_path = os.path.join(root, folder)ifnot os.listdir(folder_path):                os.rmdir(folder_path)```
说明:
此Python脚本可以搜索并删除指定目录中的空文件夹。它可以帮助您在处理大量数据时保持文件夹结构的干净整洁。

1.3 重命名多个文件

```# Python script to rename multiple files in a directoryimport osdef rename_files(directory_path, old_name, new_name):    for filename in os.listdir(directory_path):        if old_name in filename:            new_filename = filename.replace(old_name, new_name)            os.rename(os.path.join(directory_path,filename),os.path.join(directory_path, new_filename))```
说明:
此Python脚本允许您同时重命名目录中的多个文件。它将旧名称和新名称作为输入,并将所有符合指定条件的文件的旧名称替换为新名称。

2. 使用Python进行网页抓取

2.1从网站提取数据

```# Python script for web scraping to extract data from a websiteimport requestsfrom bs4 import BeautifulSoupdef scrape_data(url):    response = requests.get(url)    soup = BeautifulSoup(response.text, 'html.parser')# Your code here to extract relevant data from the website```
说明:
此Python脚本利用requests和BeautifulSoup库从网站上抓取数据。它获取网页内容并使用BeautifulSoup解析HTML。您可以自定义脚本来提取特定数据,例如标题、产品信息或价格。

2.2从网站提取数据

```# Python script to download images in bulk from a websiteimport requestsdef download_images(url, save_directory):    response = requests.get(url)    if response.status_code == 200:        images = response.json() # Assuming the API returns a JSON array of image URLs        for index, image_url in enumerate(images):            image_response = requests.get(image_url)            if image_response.status_code == 200:                with open(f"{save_directory}/image_{index}.jpg""wb"as f:                    f.write(image_response.content)```
说明:
此Python脚本旨在从网站批量下载图像。它为网站提供返回图像URL数组的JSON API。然后,该脚本循环访问URL并下载图像,并将其保存到指定目录。

2.3自动提交表单

```# Python script to automate form submissions on a websiteimport requestsdef submit_form(url, form_data):    response = requests.post(url, data=form_data)    if response.status_code == 200:    # Your code here to handle the response after form submission```
说明:
此Python脚本通过发送带有表单数据的POST请求来自动在网站上提交表单。您可以通过提供URL和要提交的必要表单数据来自定义脚本。

3. 文本处理和操作

3.1计算文本文件中的字数

```# Python script to count words in a text filedef count_words(file_path):    with open(file_path, 'r'as f:        text = f.read()        word_count = len(text.split())    return word_count```
说明:
此Python脚本读取一个文本文件并计算它包含的单词数。它可用于快速分析文本文档的内容或跟踪写作项目中的字数情况。

3.2从网站提取数据

```# Python script to find and replace text in a filedef find_replace(file_path, search_text, replace_text):    with open(file_path, 'r'as f:        text = f.read()        modified_text = text.replace(search_text, replace_text)    with open(file_path, 'w'as f:        f.write(modified_text)```
说明:
此Python脚本能搜索文件中的特定文本并将其替换为所需的文本。它对于批量替换某些短语或纠正大型文本文件中的错误很有帮助。

3.3生成随机文本

```# Python script to generate random textimport randomimport stringdef generate_random_text(length):    letters = string.ascii_letters + string.digits + string.punctuation    random_text = ''.join(random.choice(letters) for i inrange(length))    return random_text```
说明:
此Python脚本生成指定长度的随机文本。它可以用于测试和模拟,甚至可以作为创意写作的随机内容来源。

4.电子邮件自动化

4.1发送个性化电子邮件

```# Python script to send personalized emails to a list of recipientsimport smtplibfrom email.mime.text import MIMETextfrom email.mime.multipart import MIMEMultipartdef send_personalized_email(sender_email, sender_password, recipients, subject, body):    server = smtplib.SMTP('smtp.gmail.com'587)    server.starttls()    server.login(sender_email, sender_password)    for recipient_email in recipients:        message = MIMEMultipart()        message['From'] = sender_email        message['To'] = recipient_email        message['Subject'] = subject        message.attach(MIMEText(body, 'plain'))        server.sendmail(sender_email, recipient_email, message.as_string())    server.quit()```
说明:
此Python脚本使您能够向收件人列表发送个性化电子邮件。您可以自定义发件人的电子邮件、密码、主题、正文和收件人电子邮件列表。请注意,出于安全原因,您在使用Gmail时应使用应用程序专用密码。

4.2通过电子邮件发送文件附件

```# Python script to send emails with file attachmentsimport smtplibfrom email.mime.multipart import MIMEMultipartfrom email.mime.base import MIMEBasefrom email import encodersdef send_email_with_attachment(sender_email,sender_password, recipient_email, subject, body, file_path):    server = smtplib.SMTP('smtp.gmail.com'587)    server.starttls()    server.login(sender_email, sender_password)    message = MIMEMultipart()    message['From'] = sender_email    message['To'] = recipient_email    message['Subject'] = subject    message.attach(MIMEText(body, 'plain'))    with open(file_path, "rb") as attachment:        part = MIMEBase('application''octet-stream')        part.set_payload(attachment.read())        encoders.encode_base64(part)        part.add_header('Content-Disposition', f"attachment; filename= {file_path}")        message.attach(part)    server.sendmail(sender_email, recipient_email, message.as_string())    server.quit()```
说明:

此 Python 脚本允许您发送带有文件附件的电子邮件。只需提供发件人的电子邮件、密码、收件人的电子邮件、主题、正文以及要附加的文件的路径。

4.3自动邮件提醒

```# Python script to send automatic email remindersimport smtplibfrom email.mime.text import MIMETextfrom datetime import datetime, timedeltadef send_reminder_email(sender_email, sender_password, recipient_email, subject, body, reminder_date):    server = smtplib.SMTP('smtp.gmail.com'587)    server.starttls()    server.login(sender_email, sender_password)    now = datetime.now()    reminder_date = datetime.strptime(reminder_date, '%Y-%m-%d')    if now.date() == reminder_date.date():        message = MIMEText(body, 'plain')        message['From'] = sender_email        message['To'] = recipient_email        message['Subject'] = subject        server.sendmail(sender_email, recipient_email, message.as_string())    server.quit()```
说明:
此Python脚本根据指定日期发送自动电子邮件提醒。它对于设置重要任务或事件的提醒非常有用,确保您不会错过最后期限。

5.自动化Excel电子表格

5.1Excel读&写

```# Python script to read and write data to an Excel spreadsheetimport pandas as pddef read_excel(file_path):    df = pd.read_excel(file_path)    return dfdef write_to_excel(data, file_path):    df = pd.DataFrame(data)    df.to_excel(file_path, index=False)```
说明:
此Python脚本使用pandas库从Excel电子表格读取数据并将数据写入新的Excel文件。它允许您通过编程处理Excel文件,使数据操作和分析更加高效。

5.2数据分析和可视化

```# Python script for data analysis and visualization with pandas and matplotlibimport pandas as pdimport matplotlib.pyplot as pltdef analyze_and_visualize_data(data):# Your code here for data analysis and visualization    pass```
说明:

此Python脚本使用pandas和matplotlib库来进行数据分析和可视化。它使您能够探索数据集、得出结论并得到数据的可视化表示。

5.3合并多个工作表

```# Python script to merge multiple Excel sheets into a single sheetimport pandas as pddef merge_sheets(file_path, output_file_path):    xls = pd.ExcelFile(file_path)    df = pd.DataFrame()    for sheet_name in xls.sheet_names:        sheet_df = pd.read_excel(xls, sheet_name)        df = df.append(sheet_df)        df.to_excel(output_file_path, index=False)```
说明:
此Python脚本将Excel文件中多个工作表的数据合并到一个工作表中。当您将数据分散在不同的工作表中但想要合并它们以进行进一步分析时,这会很方便。

6.与数据库交互

6.1连接到一个数据库

```# Python script to connect to a database and execute queriesimport sqlite3def connect_to_database(database_path):    connection = sqlite3.connect(database_path)    return connectiondef execute_query(connection, query):    cursor = connection.cursor()    cursor.execute(query)    result = cursor.fetchall()    return result```
说明:

此Python脚本允许您连接到SQLite数据库并执行查询。您可以使用适当的Python数据库驱动程序将其调整为与其他数据库管理系统(例如MySQL或PostgreSQL)配合使用。

6.2执行SQL查询

```# Python script to execute SQL queries on a databaseimport sqlite3def execute_query(connection, query):    cursor = connection.cursor()    cursor.execute(query)    result = cursor.fetchall()    return result```
说明:
此Python脚本是在数据库上执行SQL查询的通用函数。您可以将查询作为参数与数据库连接对象一起传递给函数,它将返回查询结果。

6.3数据备份与恢复

```import shutildef backup_database(database_path, backup_directory):    shutil.copy(database_path, backup_directory)def restore_database(backup_path, database_directory):    shutil.copy(backup_path, database_directory)```
说明:
此Python 脚本允许您创建数据库的备份并在需要时恢复它们。这是预防您的宝贵数据免遭意外丢失的措施。

7.社交媒体自动化

7.1发送个性化电子邮件

```# Python script to automate posting on Twitter and Facebookfrom twython import Twythonimport facebookdef post_to_twitter(api_key, api_secret, access_token, access_token_secret, message):    twitter = Twython(api_key, api_secret, access_token, access_token_secret)    twitter.update_status(status=message)def post_to_facebook(api_key, api_secret, access_token, message):    graph = facebook.GraphAPI(access_token)    graph.put_object(parent_object='me', connection_name='feed', message=message)```
说明:

此 Python 脚本利用Twython和facebook-sdk库自动在Twitter和Facebook上发布内容。您可以使用它将 Python 脚本中的更新、公告或内容直接共享到您的社交媒体配置文件。

7.2社交媒体自动共享

```# Python script to automatically share content on social media platformsimport randomdef get_random_content():# Your code here to retrieve random content from a list or databasepassdef post_random_content_to_twitter(api_key, api_secret, access_token, access_token_secret):content = get_random_content()post_to_twitter(api_key, api_secret, access_token, access_token_secret, content)def post_random_content_to_facebook(api_key, api_secret, access_token):content = get_random_content()post_to_facebook(api_key, api_secret, access_token, content)```
说明:
此Python 脚本自动在Twitter和Facebook上共享随机内容。您可以对其进行自定义,以从列表或数据库中获取内容并定期在社交媒体平台上共享。

7.3 抓取社交媒体数据

```# Python script for scraping data from social media platformsimport requestsdef scrape_social_media_data(url):    response = requests.get(url)# Your code here to extract relevant data from the response```
说明:
此Python脚本执行网页抓取以从社交媒体平台提取数据。它获取所提供URL的内容,然后使用BeautifulSoup等技术来解析HTML并提取所需的数据。

8.自动化系统任务

8.1管理系统进程

```# Python script to manage system processesimport psutildef get_running_processes():return [p.info for p in psutil.process_iter(['pid''name''username'])]def kill_process_by_name(process_name):for p in psutil.process_iter(['pid''name''username']):if p.info['name'] == process_name:p.kill()```
说明:
此Python 脚本使用 psutil 库来管理系统进程。它允许您检索正在运行的进程列表并通过名称终止特定进程。

8.2使用 Cron 安排任务

```# Python script to schedule tasks using cron syntaxfrom crontab import CronTabdef schedule_task(command, schedule):cron = CronTab(user=True)job = cron.new(command=command)job.setall(schedule)cron.write()```
说明:
此Python 脚本利用 crontab 库来使用 cron 语法来安排任务。它使您能够定期或在特定时间自动执行特定命令。

8.3自动邮件提醒

```# Python script to monitor disk space and send an alert if it's lowimport psutildef check_disk_space(minimum_threshold_gb):disk = psutil.disk_usage('/')free_space_gb = disk.free / (230# Convert bytes to GBif free_space_gb < minimum_threshold_gb:# Your code here to send an alert (email, notification, etc.)pass```
说明:
此Python 脚本监视系统上的可用磁盘空间,并在其低于指定阈值时发送警报。它对于主动磁盘空间管理和防止由于磁盘空间不足而导致潜在的数据丢失非常有用。

9.自动化图像编辑

9.1图像大小调整和裁剪

```# Python script to resize and crop imagesfrom PIL import Imagedefresize_image(input_path, output_path, widthheight):    image = Image.open(input_path)    resized_image = image.resize((width, height), Image.ANTIALIAS)    resized_image.save(output_path)defcrop_image(input_path, output_path, left, top, right, bottom):    image = Image.open(input_path)    cropped_image = image.crop((left, top, right, bottom))    cropped_image.save(output_path)```
说明:
此Python脚本使用Python图像库(PIL)来调整图像大小和裁剪图像。它有助于为不同的显示分辨率或特定目的准备图像。

9.2为图像添加水印

```# Python script to add watermarks to imagesfrom PIL import Imagefrom PIL import ImageDrawfrom PIL import ImageFontdefadd_watermark(input_path, output_path, watermark_text):image = Image.open(input_path)draw = ImageDraw.Draw(image)font = ImageFont.truetype('arial.ttf'36)draw.text((1010), watermark_text, fill=(255255255128), font=font)image.save(output_path)```
说明:
此Python 脚本向图像添加水印。您可以自定义水印文本、字体和位置,以实现您图像的个性化。
9.3创建图像缩略图
```# Python script to create image thumbnailsfrom PIL import Imagedefcreate_thumbnail(input_path, output_path, size=(128128)):image = Image.open(input_path)image.thumbnail(size)image.save(output_path)```
说明:
此Python 脚本从原始图像创建缩略图,这对于生成预览图像或减小图像大小以便更快地在网站上加载非常有用。

小结

以上是本文为您介绍的9个可以用于工作自动化的最佳Python脚本。在下篇中,我们将为您介绍网络自动化数据清理和转换自动化 PDF 操作、自动化GUI、自动化测试自动化云服务财务自动化自然语言处理
自动化不仅可以节省时间和精力,还可以降低出错风险并提高整体生产力。通过自定义和构建这些脚本,您可以创建定制的自动化解决方案来满足您的特定需求。
还等什么呢?立即开始使用Python 实现工作自动化,体验简化流程和提高效率的力量。

10.网络自动化

10.1检查网站状态

```# Python script to check the status of a websiteimport requestsdefcheck_website_status(url):response = requests.get(url)if response.status_code == 200:# Your code here to handle a successful responseelse:# Your code here to handle an unsuccessful response```
说明:
此Python 脚本通过向提供的 URL 发送 HTTP GET 请求来检查网站的状态。它可以帮助您监控网站及其响应代码的可用性。

10.2自动 FTP 传输

```# Python script to automate FTP file transfersfrom ftplib import FTPdef ftp_file_transfer(host, username, password, local_file_path, remote_file_path):with FTP(host) as ftp:ftp.login(user=username, passwd=password)with open(local_file_path, 'rb'as f:ftp.storbinary(f'STOR {remote_file_path}', f)```
说明:
此Python 脚本使用 FTP 协议自动进行文件传输。它连接到 FTP 服务器,使用提供的凭据登录,并将本地文件上传到指定的远程位置。

10.3网络配置设置

```# Python script to automate network device configurationfrom netmiko import ConnectHandlerdef configure_network_device(host, username, password, configuration_commands):device = {'device_type''cisco_ios','host': host,'username': username,'password': password,}with ConnectHandler(device) as net_connect:net_connect.send_config_set(configuration_commands)```
说明:
此Python 脚本使用 netmiko 库自动配置网络设备,例如 Cisco路由器和交换机。您可以提供配置命令列表,此脚本将在目标设备上执行它们。

11. 数据清理和转换

11.1从数据中删除重复项

```# Python script to remove duplicates from dataimport pandas as pddef remove_duplicates(data_frame):cleaned_data = data_frame.drop_duplicates()return cleaned_data```
说明:
此Python脚本能够利用 pandas 从数据集中删除重复行,这是确保数据完整性和改进数据分析的简单而有效的方法。

11.2数据标准化

```# Python script for data normalizationimport pandas as pddef normalize_data(data_frame):normalized_data = (data_frame - data_frame.min()) / (data_frame.max() -  data_frame.min())return normalized_data```
说明:
此Python 脚本使用最小-最大标准化技术对数据进行标准化。它将数据集中的值缩放到 0 到 1 之间,从而更容易比较不同的特征。
11.3处理缺失值
```# Python script to handle missing values in dataimport pandas as pddef handle_missing_values(data_frame):filled_data = data_frame.fillna(method='ffill')return filled_data```
说明:
此Python 脚本使用 pandas 来处理数据集中的缺失值。它使用前向填充方法,用先前的非缺失值填充缺失值。

12. 自动化 PDF 操作

12.1从PDF中提取文本

```# Python script to extract text from PDFsimportPyPDF2def extract_text_from_pdf(file_path):with open(file_path, 'rb'as f:pdf_reader = PyPDF2.PdfFileReader(f)text = ''for page_num in range(pdf_reader.numPages):page = pdf_reader.getPage(page_num)text += page.extractText()return text```
说明:
此Python 脚本使用PyPDF2库从PDF文件中提取文本。它读取PDF的每一页并将提取的文本编译为单个字符串。

12.2合并多个PDF

```# Python script to merge multiple PDFs into a single PDFimport PyPDF2def merge_pdfs(input_paths, output_path):pdf_merger = PyPDF2.PdfMerger()for path in input_paths:with open(path, 'rb'as f:pdf_merger.append(f)with open(output_path, 'wb'as f:pdf_merger.write(f)```
说明:
此Python脚本将多个PDF文件合并为一个PDF文档。它可以方便地将单独的PDF、演示文稿或其他文档合并为一个统一的文件。
12.3添加密码保护
```# Python script to add password protection to a PDFimport PyPDF2def add_password_protection(input_path, output_path, password):with open(input_path, 'rb'as f:pdf_reader = PyPDF2.PdfFileReader(f)pdf_writer = PyPDF2.PdfFileWriter()for page_num in range(pdf_reader.numPages):page = pdf_reader.getPage(page_num)pdf_writer.addPage(page)pdf_writer.encrypt(password)with open(output_path, 'wb'as output_file:pdf_writer.write(output_file)```
说明:
此Python脚本为PDF文件添加密码保护。它使用密码对PDF进行加密,确保只有拥有正确密码的人才能访问内容。

13. 自动化GUI 

13.1自动化鼠标和键盘

```# Python script for GUI automation using pyautoguiimport pyautoguidef automate_gui():# Your code here for GUI automation using pyautoguipass```
说明:
此Python 脚本使用 pyautogui 库,通过模拟鼠标移动、单击和键盘输入来自动执行 GUI 任务。它可以与 GUI 元素交互并执行单击按钮、键入文本或导航菜单等操作。

13.2创建简单的 GUI 应用程序

```# Python script to create simple GUI applications using tkinterimport tkinter as tkdef create_simple_gui():# Your code here to define the GUI elements and behaviorpass```
说明:
此Python 脚本可以使用 tkinter 库创建简单的图形用户界面 (GUI)。您可以设计窗口、按钮、文本字段和其他 GUI 元素来构建交互式应用程序。
13.3处理GUI事件
```# Python script to handle GUI events using tkinterimport tkinter as tkdef handle_gui_events():passdef on_button_click():# Your code here to handle button click eventroot = tk.Tk()button = tk.Button(root, text="Click Me", command=on_button_click)button.pack()root.mainloop()```
说明:
此Python 脚本演示了如何使用 tkinter 处理 GUI 事件。它创建一个按钮小部件并定义了一个回调函数,该函数将在单击按钮时执行。

14. 自动化测试

14.1使用 Python 进行单元测试

```# Python script for unit testing with the unittest moduleimport unittestdef add(a, b):return a + bclass TestAddFunction(unittest.TestCase):def test_add_positive_numbers(self):self.assertEqual(add(23), 5)def test_add_negative_numbers(self):self.assertEqual(add(-2, -3), -5)def test_add_zero(self):self.assertEqual(add(50), 5)if __name__ == '__main__':unittest.main()```
说明:
该Python脚本使用unittest模块来执行单元测试。它包括add 函数的测试用例,用正数、负数和零值检查其行为。

14.2用于 Web 测试的 Selenium

```# Python script for web testing using Seleniumfrom selenium import webdriverdefperform_web_test():driver = webdriver.Chrome()driver.get("https://www.example.com")# Your code here to interact with web elements and perform testsdriver.quit()```
说明:
此Python 脚本使用 Selenium 库来自动化 Web 测试。它启动 Web 浏览器,导航到指定的 URL,并与 Web 元素交互以测试网页的功能。
14.3测试自动化框架
```# Python script for building test automation frameworks# Your code here to define the framework architecture and tools```
说明:
构建测试自动化框架需要仔细的规划和组织。该脚本是一个创建自定义的、适合您的特定项目需求的测试自动化框架的起点。它涉及定义架构、选择合适的工具和库以及创建可重用的测试函数。

15. 自动化云服务

15.1向云空间上传文件

```# Python script to automate uploading files to cloud storage# Your code here to connect to a cloud storage service (e.g., AWS S3, Google Cloud Storage)# Your code here to upload files to the cloud storage```
说明:
自动将文件上传到云存储的过程可以节省时间并简化工作流程。利用相应的云服务API,该脚本可作为将云存储功能集成到 Python 脚本中的起点。

15.2管理AWS资源

```# Python script to manage AWS resources using Boto3import boto3def create_ec2_instance(instance_type, image_id, key_name, security_group_ids):ec2 = boto3.resource('ec2')instance = ec2.create_instances(ImageId=image_id,InstanceType=instance_type,KeyName=key_name,SecurityGroupIds=security_group_ids,MinCount=1,MaxCount=1)return instance[0].id ```
说明:
此Python 脚本使用 Boto3 库与 Amazon Web Services (AWS) 交互并创建 EC2 实例。它可以扩展以执行各种任务,例如创建 S3 buckets、管理 IAM 角色或启动 Lambda 函数。
15.3自动化 Google 云端硬盘
```# Python script to automate interactions with Google Drive# Your code here to connect to Google Drive using the respective API# Your code here to perform tasks such as uploading files, creating folders, etc.```
说明:
以编程方式与Google Drive 交互可以简化文件管理和组织。该脚本可以充当一个利用 Google Drive API 将 Google Drive 功能集成到 Python 脚本中的起点。

16. 财务自动化

16.1分析股票价格

```# Python script for stock price analysis# Your code here to fetch stock data using a financial API (e.g., Yahoo Finance)# Your code here to analyze the data and derive insights```
说明:
自动化获取和分析股票价格数据的过程对投资者和金融分析师来说是十分有益的。该脚本可作为一个使用金融 API 将股票市场数据集成到 Python 脚本中的起点。

16.2货币汇率

```# Python script to fetch currency exchange rates# Your code here to connect to a currency exchange API (e.g., Fixer.io, Open Exchange Rates)# Your code here to perform currency conversions and display exchange rates```
说明:
此Python 脚本利用货币兑换 API 来获取和显示不同货币之间的汇率。它可用于财务规划、国际贸易或旅行相关的应用程序。
16.3预算追踪
```# Python script for budget tracking and analysis# Your code here to read financial transactions from a CSV or Excel file# Your code here to calculate income, expenses, and savings# Your code here to generate reports and visualize budget data```
说明:
此Python 脚本使您能够通过从 CSV 或 Excel 文件读取财务交易来跟踪和分析预算。它反映有关收入、支出和储蓄的情况,帮助您作出明智的财务决策。

17. 自然语言处理

17.1情感分析

```# Python script for sentiment analysis using NLTK or other NLP librariesimportnltkfromnltk.sentiment import SentimentIntensityAnalyzerdefanalyze_sentiment(text):nltk.download('vader_lexicon')sia = SentimentIntensityAnalyzer()sentiment_score = sia.polarity_scores(text)return sentiment_score```
说明:
此Python 脚本使用 NLTK 库对文本数据进行情感分析。它计算情绪分数,这个分数表示所提供文本的积极性、中立性或消极性。

17.2文本摘要

```# Python script for text summarization using NLP techniques# Your code here to read the text data and preprocess it (e.g., removing stop words)# Your code here to generate the summary using techniques like TF-IDF, TextRank, or BERT```
说明:
文本摘要自动执行为冗长的文本文档创建简洁摘要的过程。该脚本可作为使用NLP 库实现各种文本摘要技术的起点。
17.3语言翻译
```# Python script for language translation using NLP libraries# Your code here to connect to a translation API (e.g., Google Translate, Microsoft Translator)# Your code here to translate text between different languages```
说明:
自动化语言翻译可以促进跨越语言障碍的沟通。该脚本可适配连接各种翻译API并支持多语言通信。

结论

在本文中,我们探索了17个可以跨不同领域自动执行各种任务的 Python 脚本。从网页抓取和网络自动化到机器学习和物联网设备控制,Python 的多功能性使我们能够高效地实现各种流程的自动化。
自动化不仅可以节省时间和精力,还可以降低出错风险并提高整体生产力。通过自定义和构建这些脚本,您可以创建定制的自动化解决方案来满足您的特定需求。
还等什么呢?立即开始使用Python 实现工作自动化,体验简化流程和提高效率的力量。

一些经常被问到的问题

1.Python适合自动化吗?

绝对适合!Python 因其简单性、可读性和丰富的库而成为最流行的自动化编程语言之一。它可以自动执行多种任务,因此成为了开发人员和 IT 专业人员的最佳选择。

2.使用 Python 自动化任务有哪些好处?

使用Python 自动化任务具有多种好处,包括提高效率、减少人工错误、节省时间和提高生产力。 Python 的易用性和丰富的库生态系统使其成为自动化项目的绝佳选择。

3. 我可以在我的项目中使用这些脚本吗?

是的,您可以使用这些脚本作为您的项目的起点。但是,请记住,提供的代码片段仅用于说明目的,可能需要修改才能满足您的特定要求和API。

4. 我需要安装任何库来运行这些脚本吗?

是的,某些脚本利用外部库。确保在运行脚本之前安装所需的库。您可以使用“pip install <library-name>”来安装任何缺少的库。

5. 我可以将这些脚本用于商业用途吗?

本文中提供的脚本旨在用于教育和说明。虽然您可以将它们用作项目的基础,但请查看并始终遵守商业项目中使用的任何外部库、API或服务的条款和条件。

6. 如何针对我的特定项目进一步优化这些脚本?

要根据您的特殊目的优化这些脚本,您可能需要修改代码、添加错误处理、自定义数据处理步骤以及与必要的API 或服务集成。您要始终记得彻底测试脚本以确保它们满足您的要求。

7. 我可以使用Python自动执行复杂的任务吗?

是的,Python能够自动执行跨多个领域的复杂任务,包括数据分析、机器学习、网络抓取等。借助正确的库和算法,您可以有效地处理复杂的任务。

8. 自动化任务时是否有任何安全考虑?

是的,在自动化涉及敏感数据、API或设备的任务时,实施安全措施至关重要。使用安全连接(HTTPS、SSH),避免对敏感信息进行硬编码,并考虑访问控制和身份验证来保护您的系统和数据。

长按或扫描下方二维码,免费获取 Python公开课和大佬打包整理的几百G的学习资料,内容包含但不限于Python电子书、教程、项目接单、源码等等

扫描二维码-免费领取

推荐阅读

这十个Python实战项目,让你瞬间读懂Python!

网页自动化测试和爬虫:Selenium库入门与进阶

这 25 个 Pandas 实用技巧你都会吗

五分钟竟能轻松掌握 Python 自动化测试 Selenium !

点击 阅读原文了解更多

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-22 01:38:36 HTTP/2.0 GET : https://f.mffb.com.cn/a/508489.html
  2. 运行时间 : 0.595589s [ 吞吐率:1.68req/s ] 内存消耗:4,809.60kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=e8f845d5f9c37506253c11c01d43dd4a
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000992s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001436s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.005301s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.007001s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001424s ]
  6. SELECT * FROM `set` [ RunTime:0.005971s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001557s ]
  8. SELECT * FROM `article` WHERE `id` = 508489 LIMIT 1 [ RunTime:0.017538s ]
  9. UPDATE `article` SET `lasttime` = 1787333916 WHERE `id` = 508489 [ RunTime:0.027512s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.001968s ]
  11. SELECT * FROM `article` WHERE `id` < 508489 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.057685s ]
  12. SELECT * FROM `article` WHERE `id` > 508489 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.056523s ]
  13. SELECT * FROM `article` WHERE `id` < 508489 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.125103s ]
  14. SELECT * FROM `article` WHERE `id` < 508489 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.078473s ]
  15. SELECT * FROM `article` WHERE `id` < 508489 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.042694s ]
0.599099s