On 2022-05-16 20:48:02 -0400, Dennis Lee Bieber wrote:
> On Mon, 16 May 2022 17:22:17 -0700 (PDT), "hongy...@gmail.com"
> <hongyi.z...@gmail.com> declaimed the following:
> >a=re.sub(r"'","",a)
> 
>       Explain what you believe this operation is doing, show us the input and
> the output.
> 
>       The best I can make out of that is that it is looking for single quote
> characters within whatever "a" is, and replacing them with nothing.
> Something much more understandable, without invoking a regular expression
> library (especially when neither the search nor the replacement terms are
> regular expressions) with simple string operations...
> 
>       stripped = "".join(quoted.split("'"))

Whether that's easier to understand it very much in the eye of the
beholder.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | h...@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to