[Tutor] Using Regular Expression to extracting string in brackets on a list
Jing Ai
jai633 at g.rwu.edu
Sun Dec 29 22:02:01 CET 2013
Hello,
I am trying to rewrite some contents on a long list that contains words
within brackets and outside brackets and I'm having trouble extracting the
words within brackets, especially since I have to add the append function
for list as well. Does anyone have any suggestions? Thank you!
*An example of list*:
['hypothetical protein BRAFLDRAFT_208408 [Branchiostoma floridae]\n',
'hypoxia-inducible factor 1-alpha [Mus musculus]\n', 'hypoxia-inducible
factor 1-alpha [Gallus gallus]\n' ]
*What I'm trying to extract out of this*:
['Branchiostoma floridae', 'Mus musculus', 'Gallus gallus']
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20131229/9eeb22f0/attachment.html>
More information about the Tutor
mailing list