0

Python: read from txt file line by line, than convert and save other txt file line by line. Print works great, but can't save th

from bitcoin import * ListOfLines = open ("words.txt", "r") def createFile(): wr = open("result.txt", "w") for line in ListOfLines: wr.write(line) wr.write('\n') wr.close() def readFile(): rd = open ("result.txt", "r") out = [] # list to save lines while True: line = rd.readline() if not line : break; out.append(line.strip()) rd.close() return out def main(): createFile() outList = readFile() for line in outList: Private_Key = sha256(line) toPublic_Key = privtopub(Private_Key) Create_Adress = pubtoaddr(toPublic_Key) print("Adress="+Create_Adress) print(Private_Key) print(line.strip()) if __name__ == "__main__": main()

26th Mar 2021, 8:44 PM
Marcus2525
1 Resposta
0
you are calling your function 'createFile' (from your 'main' function) without/before having initialized the 'listOfLines' variable that you need to iterate inside it ^^
26th Mar 2021, 8:53 PM
visph
visph - avatar