我有一些简单的Python代码,用于在文件中搜索一个字符串,例如path=c:\path
,其中c:\path
部分可能会有所变化。当前的代码是:
def find_path(i_file):
lines = open(i_file).readlines()
for line in lines:
if line.startswith("Path="):
return # what to do here in order to get line content after "Path=" ?
如何简单获取 Path=
后面的文本?