[Solved] Extract string from text file using python [closed]


import re


FILEPATH = "./file.txt"


def main():
    pattern = re.compile("'serial_number\'\: u\'(.*?)\'")
    with open(FILEPATH, 'rU') as f:
        print(pattern.findall(f.read()))


if __name__ == "__main__":
    main()

4

solved Extract string from text file using python [closed]