Untitled
unknown
plain_text
3 years ago
597 B
13
Indexable
clean_pattern = re.compile(r'([\'\"]{3})$|^([\'\"]{3})') # remove python ''' or """
clean_pattern1 = re.compile(r'([#]+)$|^([#]+)') # special single-line comment with #
clean_pattern2 = re.compile(r'([\/*=-]+)$|^([\/*!=-]+)')
docstring = re.sub(clean_pattern, '', docstring)
new_docstring = []
for line in docstring.split('\n'):
if remove_whitespace:
line = line.strip()
line = re.sub(clean_pattern1, '', line)
line = re.sub(clean_pattern2, '', line)
new_docstring.append(line)
return '\n'.join(new_docstring)Editor is loading...