![](/img/trans.png)
[英]How to extract certain substring from a multi line string in Python?
[英]How to extract certain string from a line of string using find.()
file_name_to_preprocessing_method("heloc_dataset_v1(exc empty rows.).csv_pre(-1,asis).csv")
应该返回字符串“(-1,asis)”,可能使用.find()
。
将re.findall
用于正则表达式方法:
inp = "file_name_to_preprocessing_method(\"heloc_dataset_v1(exc empty rows.).csv_pre(-1,asis).csv\")"
matches = re.findall(r'\bcsv_pre(\(.*?\))', inp)
print(matches[0]) # (-1,asis)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.