Wednesday, 6 September 2017

How to remove extraneous spaces from Python array?

I have a python array containing a mixed set of values that looks somewhat like the example below:



['0012 ', ' 318422 ', ' www.example.com']


My question is, how can I easily remove leading and trailing spaces from values in the array, such that it looks like this:



['0012', '318422', 'www.example.com']

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...