In kivy app on start it receives a json values assigns them to a variable and appends them to a list. On every App launch it receives a different values, therefore list is always different.
Ch1_name = channel.json()['items']['channels'][0]['channelName']
Ch2_name = channel.json()['items']['channels'][1]['channelName']
Ch3_name = channel.json()['items']['channels'][2]['channelName']
Ch4_name = channel.json()['items']['channels'][3]['channelName']
channels = []
channels.append(Ch1_name)
channels.append(Ch2_name)
channels.append(Ch3_name)
channels.append(Ch4_name)
print(channels)
['cnn','fox','sky sports','fsc']
Question: i need to create functions for each channel, that will preserve a name of a list item which is a channel name. Something like:
def cnn()
print('this function was named cnn just like an item list')
Maybe there is a different way to do it with a class? Thank you for any ideas.