Aryan Yadav (0901CS231025) Python Macro Micro
Aryan Yadav (0901CS231025) Python Macro Micro
(Deemed University)
NAAC Accredited with A++ Grade
Submitted By:
Aryan Yadav (0901CS231025)
Submitted to:
Dr. Rahul Dubey
Faculty Mentor
Assistant Professor
JULY-DEC 2024
CONTENTS
2. Declaration
3. Acknowledgment
4. Contents
5. MICRO PROJECT:
a. Introduction
b. Implementation
c. Results
6. MACRO PROJECT:
d. Introduction
e. Implementation
f. Results
7. Conclusion
MICRO PROJECT
INTRODUCTION
The project not only eliminates human errors but also ensures consistency and
scalability, making it suitable for institutions handling large volumes of student
data. From integrating marks to creating summaries, the application provides a
seamless workflow that saves time for educators and administrators. By
demonstrating the practical applications of Python in education management, this
project highlights the potential of programming in addressing real-world
problems while promoting smarter, technology-driven solutions for everyday
challenges.
IMPLEMENTATION
import os
def add_student():
file.write(f"{roll_no},{name},{marks}\n")
def view_students():
if os.path.exists("student_records.txt"):
print("\nStudent Records:")
else:
def generate_report():
if os.path.exists("student_records.txt"):
report.write("Student Report\n")
report.write("=" * 50 + "\n")
report.write("=" * 50 + "\n")
else:
def main():
while True:
print("4. Exit")
if choice == "1":
add_student()
view_students()
generate_report()
break
else:
if __name__ == "__main__":
main()
RESULTS
MACRO PROJECT
INTRODUCTION
In the digital world, where information is stored in the form of countless files,
efficient file management plays a crucial role in maintaining order and
productivity. One of the most common tasks for anyone working with digital
files—whether for personal or professional use—is renaming files in bulk.
However, this task can become repetitive and time-consuming, especially when
dealing with a large number of files.
Built with a creative and intuitive user interface (UI) using Python’s Tkinter
library, this project offers a user-friendly approach to batch file renaming. By
allowing users to add custom prefixes, suffixes, or both, Auto File Renamer
ensures flexibility in naming conventions and reduces the manual labor involved
in file management tasks.
The Auto File Renamer works by simplifying the process of renaming multiple
files within a selected folder, allowing users to apply a prefix and/or suffix to
each filename. Below is an overview of its functionality:
1. Folder Selection:
The user selects a folder containing the files they want to rename. This is
done by clicking a button that opens a file dialog where they can browse
and choose the target folder.
2. Prefix and Suffix Input:
Users can enter a prefix (text to add before the filename) and/or a suffix
(text to add after the filename but before the file extension). This provides
flexibility, allowing users to choose the most suitable naming convention
for their files.
3. Renaming Process:
After the folder and desired name alterations are selected, the user clicks
the "Rename Files" button. The program will automatically loop
through all files in the selected folder, rename them by adding the entered
prefix and/or suffix, and save the new names in place of the old ones.
4. Error Handling and Feedback:
The application ensures that no action is taken if no folder is selected or if
no prefix or suffix is entered. It displays appropriate error messages and
provides confirmation upon successful completion of the renaming
process.
Efficient: Quickly renames files in bulk without the need for manual input
for each file.
Customizable: Offers the ability to add a prefix, suffix, or both to
filenames, giving users full control over the naming format.
Intuitive UI: The application features an easy-to-use interface, designed
with simplicity in mind, making it accessible even for non-technical users.
Cross-Platform: Built using Python and Tkinter, the application is
compatible with most operating systems, ensuring broad accessibility.
Time-Saving: Automates repetitive tasks, enabling users to focus on more
important work while the program handles file organization.
IMPLEMENTATION
import os
import tkinter as tk
from tkinter import filedialog, messagebox
try:
files = os.listdir(folder_path)
renamed_count = 0
for idx, file in enumerate(files, start=1):
file_path = os.path.join(folder_path, file)
if os.path.isfile(file_path):
name, ext = os.path.splitext(file)
new_name = f"{prefix}{name}{suffix}{ext}"
os.rename(file_path, os.path.join(folder_path, new_name))
renamed_count += 1
# Header label
header = tk.Label(window, text="Auto File Renamer", font=("Arial", 18,
"bold"), bg="#f4f4f4", fg="#333")
header.pack(pady=10)
# Footer
footer = tk.Label(window, text="Created by Team: Syntax Handlers",
font=("Arial", 10), bg="#f4f4f4", fg="#888")
footer.pack(side="bottom", pady=10)
The Auto File Renamer project streamlines the process of organizing files by
renaming them based on specific patterns or criteria. It is highly practical for
managing large volumes of files, enhancing productivity, and reducing errors in
manual renaming. This project demonstrates the power of automation in
simplifying routine tasks.