for example :
res = {}
ids = []
So what is the difference in these two?
Thanks in advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
for example :
res = {}
ids = []
So what is the difference in these two?
Thanks in advance
Yes, the previous comment is correct.
res = {} is a dictionary
ids = [] is a list
Dictionaries have keys and values, stored like this:
res = {
'key1': 'value1',
'key2': 'value2',
}
print res['key1'] # This will print "value1"
print res['key2'] # This will print "value2"
Lists have only indices and values, stored like this:
ids = ['this', 'that', 'foo', 'bar']
print ids[0] # This will print "this"
print ids[1] # This will print "that"
print ids[2] # This will print "foo"
print ids[3] # This will print "bar"
This is also a Set res = {1,2,3} That is not a dict but is using {...}
this is the data concept of python list and dictionary https://docs.python.org/2/tutorial/datastructures.html
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up