<p dir="ltr"> str.split takes a limit argument. Try your_string.split('_', 1)</p>
<div class="gmail_quote">On 16 May 2013 16:11, "loial" <<a href="mailto:jldunn2000@gmail.com">jldunn2000@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I want to split a string so that I always return everything BEFORE the LAST underscore<br>
<br>
HELLO_xxxxxxxx.lst         # should return HELLO<br>
HELLO_GOODBYE_xxxxxxxx.ls  # should return HELLO_GOODBYE<br>
<br>
I have tried with rsplit but cannot get it to work.<br>
<br>
Any help appreciated<br>
<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</blockquote></div>