lundi 18 juillet 2016

What is an elegant way to convert the result of [x for x in y] from list to a regular variable?


What is an elegant way to convert the result of [x for x in y] from list to a regular variable? result= [x for x in range(10) if x==7] The result of the above will be [7]. I am now using result=result[0] but ...it does not look right :-) thanks

Aucun commentaire:

Enregistrer un commentaire