This repository contains Python scripts for working with files, JSON, and SQL databases. It includes methods to read, write, and manipulate files, interact with SQL databases using MySQL, and handle JSON data efficiently.
- Read and write files using Python
- Work with JSON data
- Connect to MySQL databases using PHPMyAdmin
- Execute SQL queries on a world database
-
Create Database:
- Go to the PHPMyAdmin panel.
- Create a new database named
world. - Download the dataset from Kaggle: World Cities SQL Dataset.
- Upload the downloaded SQL file into your
worlddatabase.
-
Start Services:
- Run the Apache server and MySQL to implement the code in Python.
-
Execute Queries:
- Run Python scripts to interact with the database and execute queries.
-
Database Overview:
- The
worlddatabase contains three datasets.
- The
- Reading JSON: Load and parse JSON data using Python.
import json
with open('data.json', 'r') as file:
data = json.load(file)
print(data)- Writing JSON: Save data into a JSON file.
import json
data = {"name": "Alice", "age": 25, "city": "New York"}
with open('data.json', 'w') as file:
json.dump(data, file, indent=4)- Python 3.x
- MySQL
- PHPMyAdmin (for SQL database management)
- Apache Server (for running MySQL and PHPMyAdmin)
- Clone the repository:
git clone <repo-url> cd <repo-folder>
- Install dependencies (if any).
- Follow the setup instructions above for SQL and JSON.
- Run Python scripts as needed:
python script.py
This project is open-source and available under the MIT License.



