Insert a value to a list within a list - python -


say have following:

wholelist = ['a', 'b', ['1', '2', '4'], 'c', 'd'] 

how add value '3' numeric list within wholelist, @ point after value '2' before value '4'?

index correct sublist, use list's insert method.

wholelist[2].insert(2, '3') 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -