#sample input
dict_ = {'country': {'0': 'a,b,c','1': 'xyz'}}
country_name = []
for country in dict_['country'].values():
if ',' in country:
country_name.append(country.split(','))
else:
country_name.append([country])
#op of above code
[['a', 'b', 'c'], ['xyz']]
how to write above code using list comprehension, so far i have tried the below. .I need to add else condition in these list comprehension
[x.split(',') for x in dict_['country'].values() if ',' in x]
expected output using list comprehension
[['a', 'b', 'c'], ['xyz']]