I have written a code to list all the components in my Linux server. The list is stored in a file. I will ready line by line and have to split the components from version and store in 2 different strings.
For eg: one of my line shows console-3.45.1-0 where console is the component and 3.45.1-0 is the version. If I use split,
print components[i].split('-')
I can see ['console', '3.45.1', '0\r\r']
which is not what I wanted. How can I split into 2 strings on the first occurrence of '-' ?