KALIIOWORK / KALIIOWORK/basic_python_programs

New Python Program: Basic File Manipulation

Offen
#8 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
good first issue hacktoberfest
Vorherrschende Sprache
Python
Sterne
0
Forks
9
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello Python enthusiasts! Let's expand our repository with a Python program that demonstrates basic file manipulation operations. This beginner-friendly task involves reading from and writing to text files, allowing users to create, read, update, and delete entries in a simple database file. This task will showcase file handling, loops, and conditional statements in Python.

**Tasks:**
- Create a Python program that reads data from a text file (`database.txt`) if it exists.
- Allow users to view existing entries, add new entries, update existing entries, and delete entries.
- Implement user-friendly menus and prompts for each operation.
- Ensure the program handles errors gracefully, such as invalid file access or incorrect user inputs.
- Save the updated data back to the text file after each operation.

**Guidelines:**
- Use Python 3.x for the program.
- Utilize file handling functions (`open`, `read`, `write`, `close`) to manipulate the database file.
- Include comments in your code to explain the logic and functionality.
- Test the program thoroughly, including edge cases and error scenarios.

**Example:**

```
Welcome to the Basic File Manipulation Program!

1. View Entries
2. Add Entry
3. Update Entry
4. Delete Entry
5. Exit

Select an option: 2
Enter name: John Doe
Enter age: 30
Entry added successfully!

1. View Entries
2. Add Entry
3. Update Entry
4. Delete Entry
5. Exit

Select an option: 1
Entries:
1. Name: John Doe, Age: 30

...
```

**How to Contribute:**
1. Fork this repository.
2. Create a new Python file for the Basic File Manipulation Program: `file_manipulation.py`.
3. Write the Python program following the specified tasks and guidelines.
4. Test the program thoroughly to ensure it functions correctly.
5. Commit your changes: `git commit -m "Add Basic File Manipulation Program"`
6. Push to your branch: `git push origin add-file-manipulation`
7. Open a pull request to this repository.

Your contribution will provide users with a practical understanding of file manipulation in Python. Thank you for creating this useful Python program for our repository!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.