my program:
values = []
for i in 10:
values.append({0,1,2,3,4,i})
the result is
values[0] = [0,1,2,3,4]
values[1] = [0,1,2,3,4]
values[2] = [0,1,2,3,4]
but the result should be :
values[0] = [0,1,2,3,4,0]
values[1] = [0,1,2,3,4,1]
values[2] = [0,1,2,3,4,2]
in each sub list the same values is repeated only once..
this array i.e values[0] is to use in python
str = """INSERT INTO tbl_user_custom_adjustments (col1, col2, col3,col4,col5, col6) VALUES {}"""
str=str.format(tuple(data))
the result query is :
INSERT INTO tbl_user_custom_adjustments (col1,col2,col3,col4,col5,col6) VALUES (0,1,2,3,4)
but the expected result should be:
INSERT INTO tbl_user_custom_adjustments (col1,col2,col3,col4,col5,col6) VALUES (0,1,2,3,4,0)
question from:
https://stackoverflow.com/questions/66063416/values-are-overriding-to-same-values-in-python-lists-when-i-use-append