<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 29, 2013 at 9:00 PM, Jing Ai <span dir="ltr"><<a href="mailto:jai633@g.rwu.edu" target="_blank">jai633@g.rwu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks, but I don't think I can get out the string in the brackets by only replacing other items...(there's too many things to replace and may interfere with the items within the string). </div>
<div class="HOEnZb"><div class="h5"><div class="gmail_extra">

<br clear="all"><div><div dir="ltr"> <br></div></div></div></div></div></blockquote><div><br></div><div>I am not sure what you mean by your previous sentence.  Check out Steven's excellent answer.  Also, remember to reply to the list, or no one will see your question.<br>
<br></div><div>Good luck <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><div><div dir="ltr"><br>
</div></div>
<br><br><div class="gmail_quote">On Sun, Dec 29, 2013 at 7:08 PM, Joel Goldstick <span dir="ltr"><<a href="mailto:joel.goldstick@gmail.com" target="_blank">joel.goldstick@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Sun, Dec 29, 2013 at 4:02 PM, Jing Ai <span dir="ltr"><<a href="mailto:jai633@g.rwu.edu" target="_blank">jai633@g.rwu.edu</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br><div>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!</div>





<div><br></div><div><b>An example of list</b>:</div><div>







<p>['hypothetical protein BRAFLDRAFT_208408 [Branchiostoma floridae]\n', 'hypoxia-inducible factor 1-alpha [Mus musculus]\n', 'hypoxia-inducible factor 1-alpha [Gallus gallus]\n' ]</p></div></div>



</div></blockquote><div><br></div></div><div>Is the above line a python  list, or is it what you get when you read a line of a data file.  The reason I ask, is if it is a list you can split the list by looping of each list item.  Then just maybe try some of these ideas:<br>



<br><a href="http://stackoverflow.com/questions/10017147/python-replace-characters-in-string" target="_blank">http://stackoverflow.com/questions/10017147/python-replace-characters-in-string</a> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<div>
<div dir="ltr"><div><div><p>

<b>What I'm trying to extract out of this</b>:</p><p>['Branchiostoma floridae', 'Mus musculus', 'Gallus gallus']</p><p><br></p><div><div><div dir="ltr"> <br><br></div></div>
</div></div></div></div>
<br></div>_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="https://mail.python.org/mailman/listinfo/tutor" target="_blank">https://mail.python.org/mailman/listinfo/tutor</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr"><div>Joel Goldstick<br></div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br>

</div>
</font></span></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Joel Goldstick<br></div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br></div>
</div></div>