Skip to main content

IceSpringPathLib

pathlib Wrapper with UTF-8 first and LineFeed first, based on pathlib3x.

Official sites

Features

  • UTF-8 is the default encoding, even on Windows
  • LineFeed is the default new-line format, even on Windows
  • All pathlib3x features

Install

  • PyPI: pip install IceSpringPathLib

Usage

import pathlib
import tempfile

import chardet

import IceSpringPathLib

tempfile.mktemp()
filename = tempfile.mktemp()
text = "Common\n\nSense\n\n天地玄黄"
print("Original text:", repr(text))

pathlib.Path(filename).write_text(text)
encoding = chardet.detect(open(filename, mode="rb").read())["encoding"]
print("\nWritten text by pathlib:", repr(open(filename, newline="", encoding=encoding).read()))
print("Written encoding by pathlib:", encoding)

IceSpringPathLib.Path(filename).write_text(text)
encoding = chardet.detect(open(filename, mode="rb").read())["encoding"]
print("\nWritten text by IceSpringPathLib:", repr(open(filename, newline="", encoding=encoding).read()))
print("Written encoding by IceSpringPathLib:", encoding)

Example Output

Original text: 'Common\n常\nSense\n识\n天地玄黄'

Written text by pathlib: 'Common\r\n常\r\nSense\r\n识\r\n天地玄黄'
Written encoding by pathlib: GB2312

Written text by IceSpringPathLib: 'Common\n常\nSense\n识\n天地玄黄'
Written encoding by IceSpringPathLib: utf-8

License

MIT

Release files for IceSpringPathLib 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for IceSpringPathLib 1.1.1
File Size Uploaded
IceSpringPathLib-1.1.1.tar.gz 18.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for IceSpringPathLib 1.1.1
File Interpreter ABI Platform
IceSpringPathLib-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.1 kB

Release files / IceSpringPathLib-1.1.1.tar.gz

Download URL IceSpringPathLib-1.1.1.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
794c3571ab01b8ca7397f8a6450292b4d50a89db05332806c6bc993dbcb119e8
BLAKE2b-256 checksum
How to use checksums
b5d9fbab1530c890450c983b065aa4ac1031bd9ece275ddf32131f1d252ccd83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / IceSpringPathLib-1.1.1-py3-none-any.whl

Download URL IceSpringPathLib-1.1.1-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3181317225a86cbda755dcb9c14ec53c44c96874d49f673dd7e09b4a0f6bed6b
BLAKE2b-256 checksum
How to use checksums
403bf7c6cf8aa052d4e9ed6f3b7630b94750369327a904a172ef87f368a03875
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page