Get value from a list


I need to get the second value from this list

['connections-wfs', 'Prueba', 'url=\n']

The data is not always the same but if you always have the same number of values, in this example it would be



asked by Sebastian 15.08.2018 в 13:24

2 answers


To get an item in a list you only need the index (using base 0):

lista = ['connections-wfs', 'Prueba', 'url=\n']

n = lista[1] # Prueba
answered by 15.08.2018 / 13:37

Assuming your list is called list1.


In the lists, you can access the determined positions, this is list [0] you will get the first value from the list, list [1] the second, list [n] will take you out the value in position n + 1 of the list.

answered by 15.08.2018 в 13:37