Compressed re.sub Example

Is there a way to convert the following Python lines (see attached image file) into a single python line?

re_sub

re.sub(",+", ",", line)

See the documentation on regular expression syntax: Regular Expression HOWTO — Python 3.9.2 documentation

1 Like