I have a condition where user I have a[]. P is a file which has all the variables l, m, n .... which are populated.
then
if a[1] = '1': p.l = a[2] elif a[1] = '2': p.m = a[2] elif a[1] = '3': p.n = a[2] these conditions keep going till 20-25 of them
What is the best way to handle this in both python 3.6 and python 2.7
Additional info
Hi, Sorry for the undetailed explanation. l,m,n,etc there are many other variables . But i will have to define them as and when needed. how every 1,2,3, and etc there might be upto 10-15 , it depends , but they are fixed as in those numbers will not change, but l,m,n are something I defined so can be modified.
Point is suppose I get a string like "Hi how are you" and "Hello how are you" then I put this string in variable say 'a'. then I split the string to a[] = ['Hi','How','Are','You'] and a[] = ['Hello','How,'Are','you']. Two separate times Now I read the
if a[1] = 'HI': p.l = a[2] elif a[1] = 'Hello': p.m = a[2] elif a[1] = 'How': p.n = a[2] So here depending on a[1] value I need to store the a[2] value in different variable. Also a[1] might have 20-25 different inputs comming. depending on the input I will have to store it in that particular variable.
l,m,nor does thePfile have 20-25 more different variables? If only the 3 variablesl,m, andn, how are the next, few subsequent variables in the 20-25 defined? Dol,m, andnrecycle for'4','5'and'6', etc?