How to split a single TXT file using a string delimiter in Python

pip install cloudmersive-convert-api-client
from __future__ import print_function
import time
import cloudmersive_convert_api_client
from import ApiException
from pprint import pprint
# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = cloudmersive_convert_api_client.SplitDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))
input_file = '/path/to/inputfile' # file | Input file to perform the operation on.
split_delimiter = 'split_delimiter_example' # str | Required; String to split up the input file on
skip_empty_elements = true # bool | Optional; If true, empty elements will be skipped in the output (optional)
# Split a single Text file (txt) by a string delimiter
api_response = api_instance.split_document_txt_by_string(input_file, split_delimiter, skip_empty_elements=skip_empty_elements)
except ApiException as e:
print("Exception when calling SplitDocumentApi->split_document_txt_by_string: %s\n" % e)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.