我想匹配Python文件的文檔字符串。例如。 r""" Hello this is Foo
"""
僅使用"""應該足夠開始。 >>> data = 'r""" Hello this is Foo\n """'
>>> def display(m):
... if not m:
... return None
... else:
... return '<
我使用: cat this_file | sed ':a;N;$!ba;s/\n[a-z]/ [a-z]/g' > that_file
示例文本: However the text \n
looks like this when it replaces the newline.\n
輸出: However the text [a-z]ooks like this when it repl