[Tutor] A simple Perl to Python regex xlation question

Smith, Jeff jsmith at medplus.com
Wed Apr 20 20:39:49 CEST 2005


What's the quickest (and most Pythonic) way to do the following Perlism:
	$str = s/d+/d/;

(i.e. collapsing multiple occurrences of the letter 'd' to just one)

Thanks,
Jeff


More information about the Tutor mailing list