Advanced Python File Handling Assignment
Name: Arun Kumar
Section A – Advanced Text File Operations
A1_chunks.py Reads large text files in chunks using a generator and counts words.
A2_log_parser.py Parses web server logs using regex and exports data to CSV.
A3_config_parser.py Reads and writes custom configuration files.
A4_search_replace.py Performs recursive search and replace across multiple files.
Section B – Structured Data Formats
B1_csv_transform.py Converts custom CSV format into standard CSV using csv module and pandas.
B2_json_update.py Validates JSON objects using schema and updates product prices.
B3_xml_to_json.py Converts XML files into JSON while preserving attributes.
B4_excel_report.py Generates Excel reports with summary and charts.
Section C – Binary Files and Serialization
C1_binary_reader.py Reads structured binary records using struct.
C2_png_metadata.py Extracts image metadata directly from PNG binary structure.
C3_pickle_vs_json.py Compares serialization performance between pickle and JSON.
C4_xor_encrypt.py Implements XOR file encryption and decryption.
Section D – File System Operations
D1_disk_usage.py Analyzes directory size and file types.
D2_file_watcher.py Monitors directories for file changes using watchdog.
D3_safe_move.py Moves files safely with conflict resolution.
D4_temp_file_processing.py Downloads files in chunks and computes SHA256 hash.
Section E – Mini Project
E_task_queue.py File-based persistent task queue with CLI.
Features:
- Add tasks
- List tasks
- Run queued tasks
- Clear queue
- Crash recovery
- Scheduled tasks
E_dashboard.py Flask web dashboard for monitoring queue and execution logs.
Running Instructions
Install dependencies:
pip install -r requirements.txt
Run scripts individually:
python A1_chunks.py python B2_json_update.py python C3_pickle_vs_json.py python D1_disk_usage.py
Mini-project:
python E_task_queue.py add add 5 7 python E_task_queue.py list python E_task_queue.py run
Run dashboard:
python E_dashboard.py Open http://127.0.0.1:5000