python - Creating while loop based on txt length? -
so trying create loop checks length of txt file. running separate script write text file while script running. when length in txt file longer 5 want break
, progress rest of script. seems need have script check txt file each cycle, unsure of how this. how set up?
code-
import time def start(): open('test.txt') token_text: token = token_text.read().splitlines() response_token = (token[0]) while len(response_token) <= 5: try: print("waiting captcha") time.sleep(1) except: print('captcha ready') break print("script start") start()
i create function obtain token length:
def token_length(): open('test.txt') file: return len(file.read().splitlines()[0]) while token_length() <= 5: print('waiting') time.sleep(1) print('ready')
Comments
Post a Comment