Commit f9267a20 by sikang

update script

parent 65412f45
...@@ -21,19 +21,19 @@ def gen_rand_str(): ...@@ -21,19 +21,19 @@ def gen_rand_str():
def get_rand_code(index): def get_rand_code(index):
code = "" code = ""
if index == 0: if index == 0:
code += ";\nString " + gen_rand_str() + "=\"" + gen_rand_str() + "\";" code += ";\nString " + gen_rand_str() + "=\"" + gen_rand_str() + "\"\n;"
return code return code
def process_file_content(path, file_name): def process_file_content(path, file_name):
print("processing content: %s..." % path) print("processing content: %s..." % path)
with open(x, "r", encoding="utf-8") as f: with open(path, "r", encoding="utf-8") as f:
# readlines以列表的形式将文件读出 # readlines以列表的形式将文件读出
lines = f.readlines() lines = f.readlines()
with open(x, "w", encoding="utf-8") as f_w: with open(path, "w", encoding="utf-8") as f_w:
for line in lines: for line in lines:
if y in line: if ";\n" in line:
line = line.replace(";\n", get_rand_code(0)) line = line.replace(";\n", get_rand_code(0))
f_w.write(line) f_w.write(line)
print("done\n") print("done\n")
......
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