Dec-03-2019, 12:09 AM
I've made this loop to pull random 1000 lines (made in other part of code) into a Textbox. It works flawlessly, though it takes maybe 10 seconds to do it.
Possible to make an Asyncio solution to speed up the loop?
Wish I could edit my OP, but here is the code that gets the lines from the text file too, I think this would need to be in the loop(?) I guess too?
Possible to make an Asyncio solution to speed up the loop?
def myClick(): oneK = 1 while oneK < 1000: keywordbox.insert(END, (fileA(kwTXT1)) + ' ' + (fileB(kwTXT2)) + ' ' + (fileC(kwTXT3)) + ' ' + (fileD(kwTXT4)) + ' ' + (fileE(kwTXT5)) + '\n') oneK += 1Thank you for reading.
Wish I could edit my OP, but here is the code that gets the lines from the text file too, I think this would need to be in the loop(?) I guess too?
def fileA(fname): lines = open(fname).read().splitlines() return random.choice(lines) def fileB(fname): lines = open(fname).read().splitlines() return random.choice(lines) def fileC(fname): lines = open(fname).read().splitlines() return random.choice(lines) def fileD(fname): lines = open(fname).read().splitlines() return random.choice(lines) def fileE(fname): lines = open(fname).read().splitlines() return random.choice(lines) def fileF(fname): lines = open(fname).read().splitlines() return random.choice(lines) def myClick(): oneK = 1 while oneK < 1000: keywordbox.insert(END, (fileA(kwTXT1)) + ' ' + (fileB(kwTXT2)) + ' ' + (fileC(kwTXT3)) + ' ' + (fileD(kwTXT4)) + ' ' + (fileE(kwTXT5)) + '\n') oneK += 1