Reputation:
i have a list....
lst = [[45], [78], [264], [74], [67], [4756], [455], [465], [4567], [4566]]
and i want to add a zero at the beginning so it looks like this....
lst = [[0], [45], [78], [264], [74], [67], [4756], [455], [465], [4567], [4566]]
This doesn't work...
lst[0] = [0]
or This...
lst.append(0,[0])
what will actually work?
cheers
Upvotes: 1
Views: 2126
Reputation: 525
As the name goes, append always adds at the end. You need to do this:
lst.insert(0, [0])
in stead of lst.append(0,[0])
Upvotes: 1