A Python module for file "rwe", manipulation, formatting and usage in various formats.
Project description
PY-MAGICK 🪄✨
pymagick is a Python module designed to facilitate file manipulation and usage in various formats. The module provides functionalities for reading, writing, and manipulating files of different types, including CSV, JSON, XML, and more. This project aims to offer an intuitive and efficient interface for working with data stored in files, providing powerful tools for common data manipulation operations.
Key Features ⚔️
- File Reading and Writing: The module provides functions to read and write data in files of various formats, including CSV, JSON, XML, etc.
- Data Manipulation: It allows performing data manipulation operations on files programmatically, such as adding, removing, or modifying data.
- File Formating: Brings an easy way to format a file at the moment you write it, even after.
- Intuitive Interface: Offers an intuitive and easy-to-use interface for Python developers, enabling efficient file operations.
- Support for Various File Formats: In addition to CSV, the module supports file manipulation in a variety of formats, making it highly versatile and useful for a range of applications.
Installation 🛠️
You can install the module using pip:
> pip install pymagick
Example Usage 💻
Full info example tester file here TESTER.py
import os
import pymagick
def test_handling(file_format, data):
output_folder = 'test-rubish'
if not os.path.exists(output_folder):
os.makedirs(output_folder)
output_file = os.path.join(output_folder, f"test{file_format}")
print(f"Testing {file_format.upper()} file handling...")
file_data = pymagick.convert(data, file_format)
print(f"{file_format.upper()} data:")
print(file_data)
pymagick.write(file_data, output_file)
print(f"{file_format.upper()} file '{output_file}' created.")
print(f"Formatting {file_format.upper()} file...")
pymagick.opformat(output_file)
print(f"{file_format.upper()} file formatted.\n")
if __name__ == "__main__":
data = {
"employees": [
{"name": "John", "age": 30, "city": "New York"},
{"name": "Alice", "age": 25, "city": "Los Angeles"},
{"name": "Bob", "age": 35, "city": "Chicago"}
]
}
test_handling('.csv', [['Name', 'Age', 'City'], ['John', 30, 'New York'], ['Alice', 25, 'Los Angeles'], ['Bob', 35, 'Chicago']])
test_handling('.json', data)
test_handling('.xml', data)
...
Quick Solve Methods 🏃♂️💨
- Quick Solve:
import pymagick """ Quickest way to perform file operations using pymagick module! """ # Example: Read CSV file data = pymagick.read('data.csv') # Example: Write data to a CSV file pymagick.write('output.csv', data) # Example: Append data to a CSV file pymagick.append('output.csv', new_data) # Example: Convert data to JSON format json_data = pymagick.convert(data, '.json') # Example: Format JSON file pymagick.format('output.json')
Contribution 🤝
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository
- Create a branch for your new feature (
git checkout -b feature/new-feature
) - Make your changes and commit (
git commit -am 'Add new feature'
) - Push the branch (
git push origin feature/new-feature
) - Open a Pull Request
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pymagick-0.1.0.tar.gz
.
File metadata
- Download URL: pymagick-0.1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d2fa1e763fcba39f85519cc8656876e093a8ba057dd31dea25043284e969104 |
|
MD5 | 1e63aacdd194955a0867df07958571dc |
|
BLAKE2b-256 | 1fc551dab4eda54ad9ff1fdbcef3686fe2363f1e6dd8f7a213ab142e2421158e |