+ 1

sub function from re module in python

sub function from re module has a input named count. Please somebody say what this input do. re.sub(pattern, old_value, string, count)

31st Jul 2019, 10:08 PM
Pouria
Pouria - avatar
3 odpowiedzi
+ 1
"The optional argument count is the maximum number of pattern occurrences to be replaced; count must be a non-negative integer. If omitted or zero, all occurrences will be replaced". https://docs.python.org/3.7/library/re.html#re.sub
31st Jul 2019, 10:18 PM
Diego
Diego - avatar
+ 2
Thank you
31st Jul 2019, 10:26 PM
Pouria
Pouria - avatar
+ 2
Python doc is very useful
1st Aug 2019, 11:21 PM
Pouria
Pouria - avatar