question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python string.strip() optional arguments not implemented

See original GitHub issue

Python

foo = 'foocba'
print(foo.strip('abc'))

foo Generated javascript prints foocba

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Michael-F-Elliscommented, Jun 23, 2017

The following works for my immediate problem but it makes my skin crawl a little.

                while a.startswith('-'):
                    a = a[1:]
                while a.endswith('-'):
                    a = a[:-1]
0reactions
Michael-F-Elliscommented, Jun 24, 2017

@fzzylogic Good point! I think there are a couple of meta-issues here so I’m going to submit those separately to promote wider discussion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strip in Python: An Overview on Strip() Function with Examples
Strip() method in string accepts only one parameter which is optional and has characters. If the specified character is available at the ...
Read more >
Python strip() – How to Trim a String or Line - freeCodeCamp
The .strip() method takes optional characters passed as arguments. The characters you add as arguments specify what characters you would like to ...
Read more >
Built-in Types — Python 3.11.1 documentation
The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, ...
Read more >
Built-in Exceptions — Python 3.11.1 documentation
If str() is called on an instance of this class, the representation of the argument(s) to the instance are returned, or the empty...
Read more >
argparse — Parser for command-line options, arguments and ...
In a script, parse_args() will typically be called with no arguments, ... usage - The string describing the program usage (default: generated from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found