Commit c6bc990a by sikang

update script

parent a6193e58
...@@ -95,9 +95,13 @@ class Function: ...@@ -95,9 +95,13 @@ class Function:
file_content = f.read() file_content = f.read()
for key in dict.keys(): for key in dict.keys():
info = re.compile(r''+key+"=(.*)\n") info = re.compile(r''+key+"=(.*)\n")
targetLine = info.search(file_content).group() result = info.search(file_content)
newLine = "%s=%s\n" % (key, dict[key]) if result is not None:
replace_line[targetLine] = newLine targetLine = result.group()
newLine = "%s=%s\n" % (key, dict[key])
replace_line[targetLine] = newLine
else:
print("%s 字段不存在 !!!"%key)
for key in replace_line.keys(): for key in replace_line.keys():
print(replace_line[key].replace("\n", "")) print(replace_line[key].replace("\n", ""))
file_content = file_content.replace(key, replace_line[key]) file_content = file_content.replace(key, replace_line[key])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment