0% found this document useful (0 votes)
22 views20 pages

Aryan Yadav (0901CS231025) Python Macro Micro

The document presents a project report from Madhav Institute of Technology & Science, detailing two Python-based projects: the Student Report Generator and the Auto File Renamer. The Student Report Generator automates the creation of academic reports, enhancing efficiency and accuracy, while the Auto File Renamer simplifies bulk file renaming through an intuitive user interface. Both projects showcase the practical applications of Python in addressing real-world challenges in education and file management.

Uploaded by

yadav1258ji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views20 pages

Aryan Yadav (0901CS231025) Python Macro Micro

The document presents a project report from Madhav Institute of Technology & Science, detailing two Python-based projects: the Student Report Generator and the Auto File Renamer. The Student Report Generator automates the creation of academic reports, enhancing efficiency and accuracy, while the Auto File Renamer simplifies bulk file renaming through an intuitive user interface. Both projects showcase the practical applications of Python in addressing real-world challenges in education and file management.

Uploaded by

yadav1258ji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

MADHAV INSTITUTE OF TECHNOLOGY & SCIENCE, GWALIOR

(Deemed University)
NAAC Accredited with A++ Grade

“Macro Micro Project Report”

Submitted By:
Aryan Yadav (0901CS231025)

Submitted to:
Dr. Rahul Dubey
Faculty Mentor
Assistant Professor

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


MADHAV INSTITUTE OF TECHNOLOGY & SCIENCE
GWALIOR - 474005 (MP) est. 1957

JULY-DEC 2024
CONTENTS

Sr. No. Content Page No.


1. Certificate

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 Student Report Generator is a Python-based project designed to streamline


and automate the process of generating academic reports. In educational
institutions, creating student reports can be a time-consuming and error-prone
task when done manually. This project addresses those challenges by providing
an efficient, accurate, and user-friendly solution. Using Python's powerful
libraries, the generator can calculate grades, format data, and create well-
structured reports in a fraction of the time it takes manually.

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():

with open("student_records.txt", "a") as file:

roll_no = input("Enter Roll Number: ")

name = input("Enter Name: ")

marks = input("Enter Marks (comma-separated, e.g., 85,90,78): ")

file.write(f"{roll_no},{name},{marks}\n")

print("Student record added successfully!")

def view_students():

if os.path.exists("student_records.txt"):

with open("student_records.txt", "r") as file:

print("\nStudent Records:")

for line in file:


roll_no, name, marks = line.strip().split(",", 2)

print(f"Roll No: {roll_no}, Name: {name}, Marks: {marks}")

else:

print("No student records found!")

def generate_report():

if os.path.exists("student_records.txt"):

with open("student_records.txt", "r") as file:

with open("student_report.txt", "w") as report:

report.write("Student Report\n")

report.write("=" * 50 + "\n")

report.write(f"{'Roll No':<10} {'Name':<20} {'Total Marks':<15}


{'Average Marks':<15}\n")

report.write("=" * 50 + "\n")

for line in file:

roll_no, name, marks = line.strip().split(",", 2)

marks_list = list(map(int, marks.split(",")))


total = sum(marks_list)

average = total / len(marks_list)

report.write(f"{roll_no:<10} {name:<20} {total:<15}


{average:<15.2f}\n")

print("Student report generated successfully! Check 'student_report.txt'.")

else:

print("No student records found!")

def main():

while True:

print("\nStudent Report Generator")

print("1. Add Student")

print("2. View Students")

print("3. Generate Report")

print("4. Exit")

choice = input("Enter your choice: ")

if choice == "1":
add_student()

elif choice == "2":

view_students()

elif choice == "3":

generate_report()

elif choice == "4":

print("Exiting program. Goodbye!")

break

else:

print("Invalid choice. Please try again!")

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.

To address this challenge, Auto File Renamer is designed as a simple yet


powerful Python application that automates the process of renaming files.
Whether you're organizing project documents, sorting media files, or preparing
datasets, this tool saves you time by offering a streamlined solution to rename
multiple files in one go.

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.

How the Project Works

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.

Key Features of Auto File Renamer

 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

# Function to select folder


def select_folder():
folder_path = filedialog.askdirectory()
if folder_path:
folder_label.config(text=folder_path)

# Function to rename files


def rename_files():
folder_path = folder_label.cget("text")
prefix = prefix_entry.get()
suffix = suffix_entry.get()

if not folder_path or folder_path == "No folder selected":


messagebox.showerror("Error", "Please select a folder.")
return

if not prefix and not suffix:


messagebox.showerror("Error", "Please enter a prefix or suffix.")
return

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

messagebox.showinfo("Success", f"Renamed {renamed_count} files


successfully!")
except Exception as e:
messagebox.showerror("Error", f"An error occurred: {e}")
# Create the main window
window = tk.Tk()
window.title("Auto File Renamer")
window.geometry("500x400")
window.resizable(False, False)
window.config(bg="#f4f4f4")

# Header label
header = tk.Label(window, text="Auto File Renamer", font=("Arial", 18,
"bold"), bg="#f4f4f4", fg="#333")
header.pack(pady=10)

# Folder selection section


folder_frame = tk.Frame(window, bg="#f4f4f4")
folder_frame.pack(pady=10)

folder_label = tk.Label(folder_frame, text="No folder selected", bg="#f4f4f4",


fg="#555", wraplength=400)
folder_label.pack(pady=5)

select_button = tk.Button(folder_frame, text="Select Folder", font=("Arial",


12), bg="#4caf50", fg="white", command=select_folder)
select_button.pack(pady=5)

# Prefix and Suffix input fields


input_frame = tk.Frame(window, bg="#f4f4f4")
input_frame.pack(pady=20)

prefix_label = tk.Label(input_frame, text="Enter Prefix:", font=("Arial", 12),


bg="#f4f4f4", fg="#333")
prefix_label.grid(row=0, column=0, padx=10, pady=5, sticky="e")

prefix_entry = tk.Entry(input_frame, width=30, font=("Arial", 12))


prefix_entry.grid(row=0, column=1, padx=10, pady=5)

suffix_label = tk.Label(input_frame, text="Enter Suffix:", font=("Arial", 12),


bg="#f4f4f4", fg="#333")
suffix_label.grid(row=1, column=0, padx=10, pady=5, sticky="e")

suffix_entry = tk.Entry(input_frame, width=30, font=("Arial", 12))


suffix_entry.grid(row=1, column=1, padx=10, pady=5)
# Rename button
rename_button = tk.Button(window, text="Rename Files", font=("Arial", 14,
"bold"), bg="#2196f3", fg="white", command=rename_files)
rename_button.pack(pady=20)

# Footer
footer = tk.Label(window, text="Created by Team: Syntax Handlers",
font=("Arial", 10), bg="#f4f4f4", fg="#888")
footer.pack(side="bottom", pady=10)

# Run the application


window.mainloop()
RESULTS
CONCLUSION

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.

The Student Report Generator automates the creation of comprehensive


academic reports by processing student data efficiently. It ensures accuracy, saves
time, and provides a scalable solution for educational institutions. This project
highlights the potential of Python in handling real-world data management
challenges.

You might also like