#!/usr/bin/pyhton3 from lib.translate import translate def parsing_file(f): with open(f) as _f: _cached = _f.read() _list = _cached.split('\n') _to_translate = [] _list = [i for i in _list if i != ''] for _str in _list: if _str.find('%_t') != -1 or _str.find('%_T') != -1: _to_translate.append(_str) return _to_translate trans_list = parsing_file('weapongenerator.lua') print(trans_list)