Running a python script on linux
pngs = [] for idx, device in enumerate(udid): pngs += glob.glob(os.getcwd() + "/logs/" + device + "_" + get_model_of_android_phone(device) + "/" + "*.png") print(glob.glob(os.getcwd() + "/logs/" + device + "_" + get_model_of_android_phone(device) + "/" + "*.png"))
The for loop will run twice and 2 pngs will be added into the array. However, only the 2nd one was added into the array.
Not too sure why the first one is missing from the array.
When i try to print the entire path, the entire path is showing.
Example of the file path
['/home/ubuntu/logs/123456789_SM-G920I/123456789google_search_android.png']
Advertisement
Answer
have you tried with append?
for idx, device in enumerate(udid): pngs.append(glob.glob(os.getcwd() + "/logs/" + device + "_" + get_model_of_android_phone(device) + "/" + "*.png")) print(glob.glob(os.getcwd() + "/logs/" + device + "_" + get_model_of_android_phone(device) + "/" + "*.png"))```