10 Handy Python Scripts to Automate Everyday Tasks
This article presents a collection of ten practical Python utilities—including file classification, train‑ticket lookup, Evernote backup, ASCII art conversion, HTML generation, a micro web framework, city information services, data‑structure visualization, StackOverflow assistance, and enhanced string handling—each explained with usage instructions and visual output examples.
01. Directory File Classification
Preface Sometimes searching or categorizing files in a directory is painful; this program arranges the file tree according to a classification rule.
Usage
Classify by Extension
Result
Classify by Modification Time
Result
Classify by First Letter/Number
Result
Restore Directory
Result
02. 12306 Ticket Query Tool
Preface Uses the 12306 public API to query remaining ticket information.
Usage
Query Tickets
Output
Wizard Mode
Output
Supported Cities
Output
03. Text Backup Cloud Repository (everbox)
Preface everbox provides an interface collection that uses Evernote as a file sandbox, turning Evernote into a text storage repository for convenient file management.
Usage
Preparation
Install Evernote SDK for Python.
Log in to Evernote developer portal, obtain a development token, and replace the token in the code.
Basic Operations
init – Create a Repository
list – List Repositories or Texts
Get all repositories
Get repository texts
pushall – Push All Texts
log – View File Records in Repository
pull – Pull Files from Repository
remove – Delete Specified Text from Repository
drag – Pull a File from Remote and Delete Record
drop – Delete a Repository
04. ASCII Art Preview
Preface Convert images to ASCII characters.
Usage
Output
05. HTML Generator
Preface Generate HTML using Python.
Usage
Deeper Example
Parameter Syntax
Injection Syntax
The code generates the HTML shown below.
06. Micro Web Framework
Preface A tiny Python web framework.
Features:
Request parsing and response generation (based on WebOb)
Routing (regex‑based)
Template rendering (based on Jinja2)
Usage
07. City Information Service
Preface Query city information using the Gaode (Amap) API.
Obtain API_KEY
Query City Summary
Zhuhai is a core city on the west bank of the Pearl River estuary, a special economic zone with a thriving economy, excellent transportation links, and a reputation as a “city of islands”.
Query City Information
Query Bus Information
08. Visual Data Structures
Preface Visualize data structures using PIL.
Stack
Linked List
2‑D Array
09. StackOverflow‑Oriented Programming
Preface Programming techniques oriented toward StackOverflow.
Preparation
Test Script: error.py
10. Enhanced String (100‑Line Implementation)
Preface A 100‑line enhanced string implementation.
Usage
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
