mercredi 6 avril 2016

while loop calling array outside

I have a working code but im stuck on a while do this do this and if thats done go back here.

Example: This line will show me a 10 "IP" list and display them

    a = 1
while a < 18:
    a = a + 2
    logging.debug(line.split(PID_ANDROID)[a])
    if a == 20:
        break

Ok thats fine its displays everything correct. Now i can call this from a def. (this is a example in my code for "debugging" only)eg

    iip = LOG_SPLITER.split(PID_ANDROID)[1]
    c = 1
while c < 16:
    c = c + 1
    st = os.popen('adb.exe shell input keyevent 67')
    st.close()
    if c == 16:
        ip = os.popen(adbInput + iip) # input IP
        ip.close()
        ip = os.popen(adbTap + '56 584') #tap scan
        ip.close()
        time.sleep(3)
        grabBox90()
        lineGoto()

ok if you look at this, i stored the "1" "IP" in the list and then called it again with iip.

the while loop is just to manually delete a text field. when it gets it inputs the IP, presses a button and then does a screen capture to tell me if the "screen" returned a RBG value.

Now what im after and iv been stuck on is.

logging.debug(line.split(PID_ANDROID)[1])

This will tell me the first entry.

what is the best way too call the second? as you can see i have to call the 3rd entry because there is non relevant information in the second and so on.

i was thinking of doing

c = 1
do my stuff
then
while c = < 20 ?
    if c == 1:
        do logging.debug(line.split(PID_ANDROID)[c])
        c = + 2
    else:
        logging.debug('Moving on to a refresh'

i am a small automated robot that checks my arduino remotely. but have a lot of rubbish come thru on logcat to use it effective over the internet. so i filter and only send "what i need"

Aucun commentaire:

Enregistrer un commentaire