I have a list that I want to add multiple values to, and I use append(), as below, to add 10 more digits:
>>> x = [1, 2, 3, 4]
>>> x.append(5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: append() takes exactly one argument (10 given)
I kind of get what this means, so then I tried doing it with a list:
>>> x = [1, 2, 3, 4]
>>> x.append([5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
>>> x
[1, 2, 3, 4, [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]]
This isn't what I want though. It contains unnecessary square brackets. What I do want is this:
>>> x = [1, 2, 3, 4]
>>> x.what_I_want([5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
>>> x
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
Is the first change that I made to take away the TypeError the correct change to make? Or is that why this isn't working?