Ir al contenido
Menú
Se marcó esta pregunta
2368 Vistas

Hello Everyone my function is:

def _get_values(self, cr, uid, context=None): l=[]
for i in range(0,21): k=str(i) j=(k,k) l.append(j) return l

I am using that function to print a list(0 to 20) in a selection field. But Zero is not considered in the list, it starts from 1 to 20. Please give me the solution.

Thanks!

Dheerendra

Avatar
Descartar

Hi Dheerendra, I just executed the above code in my test.py file and got this output :

[('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', ' 6'), ('7', '7'), ('8', '8'), ('9', '9'), ('10', '10'), ('11', '11'), ('12', '12' ), ('13', '13'), ('14', '14'), ('15', '15'), ('16', '16'), ('17', '17'), ('18', '18'), ('19', '19'), ('20', '20')]

It's printing zero. Let me know if i'm missing something :)

Cheers

ASP