I am having some difficulty coming up with an efficient way of taking a list of strings and converting it to tuple pairs. I have a list similar to:
listOfNames = ['red-l','blue-l','green-s','red-s','blue-s']
Every color in this example (red, blue, and green) has either a '-l' or '-s' entry or both. I need to convert this list of strings into tuple pairs such as:
tupleOfNames = [('red-l','red-s'),(None,'green-s'),('blue-l','blue-s')]
I think regular expressions is needed but I am not sure how to do so. Any help is greatly appreciated. Thanks
