1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/env python3 # _*_ coding=utf-8 _*_ import re def main(): with open("./config", "r") as config_file: lines = config_file.readlines() for line in lines: print(re.sub("password\\s*=\\s*\"(.*)\"", "password=\"\"", line), end="") if __name__ == "__main__": main()