Is there a way to slice only the first and last item in a list?
For example; If this is my list:
>>> some_list
[\'1\', \'B\', \'3\', \'D\',
These are all interesting but what if you have a version number and you don't know the size of any one segment in string from and you want to drop the last segment. Something like 20.0.1.300 and I want to end up with 20.0.1 without the 300 on the end. I have this so far:
str('20.0.1.300'.split('.')[:3])
which returns in list form as:
['20', '0', '1']
How do I get it back to into a single string separated by periods
20.0.1