Python progress bar confusion, how to add progress bar to already existing loop -


after looking @ following question regards python progress bars, still confused: python progress bar

i new python , trying add progress bar script created runs loop. loop takes significant amount of time process want progress bar show when loop running. part confuses me is, have set loop inside of loop in order implement progress bar? here sample of loop code:

for member in members:     url = "http://api.wiki123.com/v1.11/member?id="+str(member)       header = {"authorization": authorization_code}      api_response = requests.get(url, headers=header)      member_check = json.loads(api_response.text)      member_status = member_check.get("response")  

do need include code add progress bar loop or have included outside of loop? thanks.

update: mention progressbar library here open suggestions of other libraries.

a simple solution print '-' @ end of loop. prints 1 hyphen each iteration of loop.

if instead wanted print out 100 hyphens, 1 hyphen each 'percent' might print '-'*(100/len(members)), check adding dashes last iteration 100.


Comments