Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

for loop for password add letters in django

so i want to check if my password less from key_bytes (which is 16) then the password will be add "0" until it’s have len 16. i was using django.
for example password = katakataka. it’s only 10. then it will became "katakataka000000"

i don’t know how to make loop for, so please help me.

here’s my code

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

key_bytes = 16
if len(key) <= key_bytes:
        for x in key_bytes:
            key = key + "0"
            print(key)

>Solution :

Is this what you are looking for?
we can use range command which have a format:
for x in range(start_count,end_count)

key_bytes = 16
key = "katakata"
if len(key) <= key_bytes:
        for x in range(len(key),key_bytes):
            key = key + "0"
            print(key)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading