[issue41605] t = re.sub(".*", "*", src) has different ouput

soyoo report at bugs.python.org
Thu Aug 20 21:01:05 EDT 2020


New submission from soyoo <soyoo at aliyun.com>:

import re

src = "123"  # can be anything
t = re.sub(".*", "*", src)

"""
The output of 't' is different in python2 and python3;
When python version is python3, it's depend on OS version.

When python version is python2, it seem always output single '*'.
When python version is python3, and OS is Linux, it output single '*';
When python version is python3, and OS is Mac or windows, it output double '**'.
"""

----------
components: 2to3 (2.x to 3.x conversion tool)
files: python3 on windows.png
messages: 375741
nosy: soyoo
priority: normal
severity: normal
status: open
title: t = re.sub(".*", "*", src) has different ouput
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file49418/python3 on windows.png

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41605>
_______________________________________


More information about the Python-bugs-list mailing list