veaba <908662...@qq.com> added the comment:
Aha, it's me. It's the mysterious power from the East. I just learned python.
I've solved my problem. It's a very simple replace replacement, and it's solved
in three lines.
I'm trying to solve the problem
veaba <908662...@qq.com> added the comment:
Yes, this is not a good place to use regular expressions.
Using regular expressions:
def actual_re_demo():
import re
# This is an indefinite string...
text = "tf.where(condition, x=None, y=None, name=None) tf.b
veaba <908662...@qq.com> added the comment:
这里来自实际我的一个项目(https://github.com/veaba/tensorflow-docs/blob/master/scripts/spider_tensorflow_docs.py#L39-L56),当然也许我这个方法不是正确的,它只是我刚学python的一个尝试。
这个项目步骤是这样:根据HTML tag 提取文本转为markdown格式。 标签,需要用符号“`”包围,然后循环里面将匹配的字符通过\\*
替换出来。
所以,你们见到了,我发现这样的一个正则溢出错误
New submission from veaba <908662...@qq.com>:
Regular match overflow
code:
```python
import re
# list => str
def list_to_str(str_list, code=""):
if isinstance(str_list, list):
return code.join(str_list)
else:
return ''
def fn_parse_code(list_