Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pathlib.Path.read_text should include a newline argument #110745

Closed
@treyhunner

Description

@treyhunner

Feature or enhancement

Proposal:

Support for anewline argument was added to thewrite_text method in Python 3.10 (issue#67894).

I've been using this method but I've found a need for anewline method forread_text as well.

Here's the scenario where this would be handy (namely reading and writing the original newlines):

frompathlibimportPathpath=Path("my_file.txt")contents=path.read_text(newline="")contents=perform_some_operation_on(contents)path.write_text(contents,newline="")

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

I have not found any prior discussions or mentions ofnewline argument being supported forread_text outside of the initial pathlib API discussion (#64417 (comment)).

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp