Skip to content

lstrip remove extra characters in the presence of a matching number #81295

Closed

Description

@AkileshK
mannequin
BPO 37114
Nosy @tiran

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2019-05-31.12:43:05.660>
created_at = <Date 2019-05-31.12:40:18.278>
labels = ['type-bug', 'invalid']
title = 'lstrip remove extra characters in the presence of a matching number'
updated_at = <Date 2019-05-31.12:43:05.657>
user = 'https://bugs.python.org/AkileshK'

bugs.python.org fields:

activity = <Date 2019-05-31.12:43:05.657>
actor = 'christian.heimes'
assignee = 'none'
closed = True
closed_date = <Date 2019-05-31.12:43:05.660>
closer = 'christian.heimes'
components = []
creation = <Date 2019-05-31.12:40:18.278>
creator = 'Akilesh K'
dependencies = []
files = []
hgrepos = []
issue_num = 37114
keywords = []
message_count = 2.0
messages = ['344070', '344072']
nosy_count = 2.0
nosy_names = ['christian.heimes', 'Akilesh K']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue37114'
versions = ['Python 2.7', 'Python 3.5']

Activity

  1. AkileshK commented on May 31, 2019

    AkileshKmannequin
    MannequinAuthor

    When the argument to lstrip / strip has a number and it matches the string it begins to act different.

    >>> text = "apiv1appliance"
    >>> text.strip("apiv1")
    'liance'
    >>> text.strip("apiv2")
    '1appliance'
    >>> text.strip("a")
    'piv1appliance'
    >>> text.strip("ap")
    'iv1appliance'
    >>> text.strip("api")
    'v1appliance'
    >>> text.strip("apiv")
    '1appliance'
    >>> text.strip("apiv1")
    'liance'
    >>> text.strip("apiv2")
    '1appliance'
  2. tiran commented on May 31, 2019

    @tiran
    Member

    It's not a bug. strip() does not work like you think. Please read the documentation https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.strip

  3. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions