Reputation: 337
i have this Variable on Airflow
['item_1', 'item_2']
then i get the variable
my_var = Variable.get('my_var')
and then i try to loop it like this
for var in my_var:
print(var)
it prints the character one by one.
My question is: how do i access the list value? without printing the character one by one
Upvotes: 3
Views: 6532
Reputation: 985
You can store it as JSON string then use deserialize_json=True
my_var = Variable.get("my_var", deserialize_json=True)
first = my_var[0]
Upvotes: 6