from js import fetch import asyncio, os, sys, io, zipfile # 5 letter word file from https://github.com/octokatherine/word-master/blob/main/src/data/words.js response = await fetch('https://willbraffitt.org/p/words5.txt') js_buffer = await response.arrayBuffer() py_buffer = js_buffer.to_py() # this is a memoryview words5 = py_buffer.tobytes().splitlines() # now we have a bytes object import re def processPattern(pattern): count = 0 for word in words5: wordstr = word.decode() if re.search(pattern, wordstr): count += 1 print(str(count) + ': ' + wordstr + '\n', end='') print(str(len(words5)) + ' words') while (pattern := input('pattern: ')) != '': processPattern(pattern) break