While learning about python, I came upon this code, which takes a text file, splits each line into an array, and inserts it into a custom dictionary, where the array[0] is the k
strip
does nothing but, removes the the whitespace in your string. If you want to remove the extra whitepace from front and back of your string, you can use strip.
The example string which can illustrate that is this:
In [2]: x = "something \t like \t this"
In [4]: x.split('\t')
Out[4]: ['something ', ' like ', ' this']
See, even after splitting with \t
there is extra whitespace in first and second items which can be removed using strip in your code.