Jan-05-2019, 02:33 PM
(This post was last modified: Jan-05-2019, 02:41 PM by AykutRobotics.)
(Jan-05-2019, 02:11 PM)stullis Wrote: You've encountered two problems. First, the error you were receiving was due to assigning multiple variables and having too many variables to unpack. Like this:
def return_3_vars(): return (1,2,3) a, b = return_3_vars() # Assigns two variables but has three values to assign; raises errorThe new problem you're encountering is that variable c is a list, not a single value. The comparisons are testing for a single string. You need to loop over c or slice it:
def main(): c = detected_objects_2() for value in c: if value == "['turnLeft']": print("Turn Left is working!!!") elif value == "['turnRight']": print("Turn Right is working!!!") else: print("NO DETECTION at all!!!") main()
I tried what you said but still I cannot see the results in python shell.
no results still
When I add print(b_values) inside of for loop, it generates but still when I go to other images, it makes a long array list inside of the same life. Otherwise, the code you wrote in the main are not working at all by python to show results in python shell.