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 — 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.4.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.4-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: file_splitter_harsh-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 136a8c7f42f50a89b726d01d14400f7f9d92956722e7bedd1c702ed76afcb837
MD5 f0e83fd44ed3eba0677237a4ef8a6d85
BLAKE2b-256 4c95aae50819d669ccd6af7454d41adc613c2c70b8ab165e1e036d3977e35510

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for file_splitter_harsh-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0abb1c6fa3159ac73a0c4cddca5eb800e4d3af2b96424906080826af880c0070
MD5 f84dcfac989c006c936db94b3ec7b991
BLAKE2b-256 f4b6ff48679333865852d8e101d0f075fe85135e7c0043a467459b7e88ed4afe

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