mardi 29 décembre 2015

How can i shorten this python code

i want to shorten this codes, all loop is acceptable. for, if(inside if), while, foreach, or another one.

I can not do it, please help me. codes is below:

def FindChannel():
rc_program_up = "Ch+"
rc_ok = "ok"
rc_exit = "exit"
value0 = checkPicture(15)

if (value0 == 100):
    send_rckey(rc_exit)
else:
    send_rckey(rc_program_up)
    value0 = checkPicture(15)

if (value0 == 100):
    send_rckey(rc_exit)
else:
    send_rckey(rc_program_up)
    value0 = checkPicture(15)

if (value0 == 100):
    send_rckey(rc_exit)
else:
    send_rckey(rc_program_up)
    value0 = checkPicture(15)

if (value0 == 100):
    send_rckey(rc_exit)
else:
    send_rckey(rc_program_up)
    value0 = checkPicture(15)

if (value0 == 100):
    send_rckey(rc_exit)
else:
    send_rckey(rc_program_up)
    value0 = checkPicture(15)

Aucun commentaire:

Enregistrer un commentaire