>>> a = ['foo.py']
>>> k = ['nice', '-n', '10']
>>> a.insert(0, k)
>>> a
[['nice', '-n', '10'], 'foo.py']
I want to list k to be on the same level as foo.py, rather than a sublist.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Apply slicing:
Or do it manually:
The first approach remain the same for insertion at any place, i.e.
a[n:n] = kwould insert k at position n, but the second approach would not be the same, that will be