Search code examples
pythonarrayslistin-place

List conversion - inplace


I am trying to convert ['1','2','3','4'] to [1,2,3,4] I want to make this conversion inplace. Is it possible to do it? If not, what is the optimal solution.


Solution

  • you can do it with list comprehension like this:

    l = [int(item) for item in l]