Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想用来re.search()在我选择的行上搜索模式,或者从我指定的行开始。这可能吗?
re.search()
当然:使用正常的字符串操作隔离该行并仅将该行传递给re.search().
例如:
lines = data.split('\n') a = re.search('regex', lines[3])