Another method of reading apparatus python

Time Import, SYS

templist = [] # is provided an empty list, the device used to put content
deviceslist = [] # is provided an empty list, the device used to put the contents of the divided
devices = [] # an empty list provided for reading pick and place device content divided
snapshot = [] # is provided an empty list, theme for reading
text = [] # is provided an empty list, for reading the results text

 
# device list has been derived adb devices> E: \ the devices.txt
# templist introduced into the device list in
f = open ( "d: \ devices.txt") # read the file
the while True:
    
    Line f.readline = () # progressive read
    print ( "information reading apparatus" , line)
    IF line:
        templist.append space (line.strip ()) # delete read lines, templist added to the list of default after each element has \ tdevices
        Print (templist)
    the else:
        BREAK;
f.close () # close the
print ( "device list", templist)
templist.pop (0) # delete the element at index 0
Print (templist)
Print (len (templist))


Each element using # \ t split and introduced into a new list of deviceslist
for I in Range (0, len (templist) -1):
    deviceslist.append (templist [I] .split ( '\ t') [0 ])

Print ( 'Current Devices:')
Print ( '----', deviceslist)

Guess you like

Origin www.cnblogs.com/lisa2016/p/11256497.html