Hi Guys, Can anyone help me redo this, so it'll be a list comprehension instead?

def parseAnnotation(annotation):
ExonStartAndStop = []
d = annotation.split(',')
for i in d:
removeparenteses = i[1:-1]
numbers = removeparenteses.split('..')
return ExonStartAndStop
example usage:
print parseAnnotation('(1834..2736)') ---> [(1834, 2736))

Here is a way

def parse(annotation):
    return list((int(x), int(y)) for (x,y) in (item.strip(" ()").split('..') for item in annotation.split(',')))

print parse('(1834..2736), (348..7734)')

""" my output -->
[(1834, 2736), (348, 7734)]

Edit: try and use the [code] button in the editor window at the bottom of this page!
Edit: it seems that pyTony gave you another nice solution last month http://www.daniweb.com/software-development/python/threads/400630/1715515#post1715515

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.