Skip to main content

Functions that enables us to write out or read from with text file in shorter syntax.

Project description

Wrapper functions of codes of text file operation that are very commonly seen. By using textfile, readability of our program will be improve!

Install

> pip install textfile

Very basic usage

Create file and write text to it.

>>> import textfile
>>> textfile.write("a.txt", "any string value")

Read text from text file.

>>> import textfile
>>> textfile.read("a.txt")
"any string value"

Use cases

Write string to text file:

textfile.write("somefile.txt", "any string value")

Read entire string from text file:

textfile.read("somefile.txt")

Replace string in text file:

textfile.replace("somefile.txt", "replaced", "replacement")

Append string to text file:

textfile.append("somefile.txt", "text to append")

Insert string to text file:

textfile.insert("somefile.txt", "text to insert", line=10)

Just a implementation of facade pattern

textfile wraps python algorithms that are very commonly used in the purpose of to more simplify basic operations.

This is just a facade pattern.

The side effect of simplify the interface of text file operation, gets less flexibility. Further more, it becomes hard to do speed tuning.

But I think that those are not a matter in almost all situations of our programming.

We should pay more attention to code readability!

I courage you to use textfile as much as possible you can. If you do so, the readability of your code will increase, and will suppress many bugs.

Is this document written in strange English?

Kenjimaru, the author of this document, I am Japanese and am not familiar to English.

If you read this document, and find anything should be fixed, feel free to contact me, and I will appreciate.

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

textfile-0.1.5.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

textfile-0.1.5-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

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