Answer the question
In order to leave comments, you need to log in
How to rewrite this script for a robot with repetitions?
I have a script like this
:
def parse_proxy_line(line: str) -> Tuple[str, int]:
addr, _, port = line.strip().rpartition(':')
return (addr, int(port))
def is_good_proxy(proxy: Tuple[str, int]) -> bool:
host, port = proxy
return ...
src = open('C:\\Users\\sinto\\PycharmProjects\\AutoREG\\Proxy.txt', 'rt')
proxies = iter(filter(is_good_proxy, map(parse_proxy_line, src)))
for i in range(3):
host, port = next(proxies)
print(host, port)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question