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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file textfile-0.1.5.tar.gz.

File metadata

  • Download URL: textfile-0.1.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.2 Darwin/22.4.0

File hashes

Hashes for textfile-0.1.5.tar.gz
Algorithm Hash digest
SHA256 057e70442275426ed76c229a14fc99e62021bb89c030748f59d29edad6475489
MD5 31e35dca19db90295251f30a82505b21
BLAKE2b-256 0b965aa5ba5647a018cd44965f601101c3e0771122f3b2f07185411b64e41149

See more details on using hashes here.

File details

Details for the file textfile-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: textfile-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.2 Darwin/22.4.0

File hashes

Hashes for textfile-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b1d111a924cc6e643a75fd317de4ded430e2a095a9ffded7c5def0d78cf48855
MD5 070906660c67f998de3ad5aba336aca0
BLAKE2b-256 8efc2b79f1c48ebc4015b495fa07ea73fa246f49c90823b35a45e6fd67aabf65

See more details on using hashes here.

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