Skip to main content

A simple Python library to split large text files into smaller parts.

Project description

file-splitter-harsh

A Python library to efficiently split large text files into smaller chunks and perfect for preprocessing large datasets, logs, or CSV files.


Installation

Install using pip:

pip install file-splitter-harsh


## Example
from filesplitter.splitter import FileSplitter

# Initialize the splitter
splitter = FileSplitter(
    file_path="large_file.txt",     # Path to the input file
    lines_per_file=1000,            # Number of lines per output file
    output_dir="output",            # Directory to save split files
    file_prefix="chunk"             # Prefix for output file names
)

# Start splitting the file
splitter.split()

| Parameter        | Type | Default        | Description                                     |
| ---------------- | ---- | -------------- | ----------------------------------------------- |
| `file_path`      | str  | Required       | Path to the input file                          |
| `lines_per_file` | int  | `1000`         | Number of lines each output file should contain |
| `output_dir`     | str  | `"output"`     | Directory where output files will be saved      |
| `file_prefix`    | str  | `"split_part"` | Prefix to use for each generated file name      |

#Example Output
If your input file has 2500 lines and lines_per_file=1000, you'll get:
output/
-chunk_1.txt  (1000 lines)
-chunk_2.txt  (1000 lines)
-chunk_3.txt  (500 lines)

Logging Example
2025-06-12 10:00:00 - INFO - File splitting complete! 3 files created in 'output'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

file_splitter_harsh-1.0.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

file_splitter_harsh-1.0.6-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file file_splitter_harsh-1.0.6.tar.gz.

File metadata

  • Download URL: file_splitter_harsh-1.0.6.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for file_splitter_harsh-1.0.6.tar.gz
Algorithm Hash digest
SHA256 d9062719efe2a38206cf211c3753212f0f2ab4dec399d9fef102bd997aaf4f0f
MD5 77dcfbcf731c033a119077b4995e03c8
BLAKE2b-256 1095bf850063e328042341b11b40a2e4dbf290f1912870204d3f27eabf36f7ae

See more details on using hashes here.

File details

Details for the file file_splitter_harsh-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for file_splitter_harsh-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 62b79e66c8e93de84adeac4e31f84596462452ff5f688e926097edabe1501aca
MD5 64c98ef20a04681c99ff0183e6bd6d19
BLAKE2b-256 5622b1a2cd9b4628d479381c6bf5b3035393c382d7c53b04fd866b00c5563f10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page