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

PEP 0515 (Underscores in Numeric Literals) not taken into account when reading headers. #592

Open
@Aycon3296

Description

@Aycon3296

Describe the error
Underscores are accepted as numbers when reading service sections.

For playback
Try to read any title that contains an underscore. For example "WELL" header item in:

~Version Information#---------------------------------------------------------------- ---------------VERS. 1.20: CWLS log ASCII Standard - VERSION 1.20WRAP. YES : Multiple lines per depth step~Well Information#---------------------------------------------------------------- ---------------#MNEM.UNIT DATA TYPE INFORMATION#--------- -------------------------- -------------- ---------STRT .M 74 : Start depthSTOP .M 1855 : Stop depthSTEP .M 0.2000 : StepNULL. -9999 : Null valueCOMP. COMPANY: TestWELL. WELL: 321_04

Expected Behavior
The title will be read as a string with underscores, but not as a number.

Software Versions (fill in the following information):

  • Python version: 3.10.5

Additional context
Due tohttps://www.python.org/dev/peps/pep-0515/ numbers containing underscores are now considered real numbers. So if you useint(value) inside a try/catch block to check whether the message read is a number, you will run into problems parsing strings like this "WELL . WELL : 321_04" (In "~W" sections).
You could check for "_" signs in the read fragment before doing this. And if the "_" signs are present, then conclude that the fragment read isstr instead ofint.

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