I have below code:
test1 = []
test11=yield context.task_all(result1)
test1.append(test11[0])
test1[0]
test2 = yield context.task_all(result2)
test11 has below value:
['success']
special variables
function variables
0: 'success'
len(): 1
I wanna get only 'success' from the variable test11. How can I get the value? here is the data which get in variable:
CodePudding user response:
To get the string 'success' from the variable test11, you can use the following code:
successString = test11[0]
This will retrieve the first element in the test11 array, which should be the string 'success'. You can then use this variable in your code as needed.
CodePudding user response:
You can get the value of 'success' from the variable test11 by accessing the 'name' property of the object at index 0 of the result1 array.
To do this, you can use the following code:
value1 = test11[0].state.name
If the value of 'name' is 'success', the value of 'value1' will be 'success'.