خرید بک لینک

Vote count: 0

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

asked 32 secs ago

- - , .
.

برچسب: نویسنده: استخدام کار تاريخ: جمعه 25 تير 1395 ساعت: 21:16

صفحه بندی