<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 27, 2013 at 11:32 AM, Sam Giraffe <span dir="ltr"><<a href="mailto:sam@giraffetech.biz" target="_blank">sam@giraffetech.biz</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"><div>Hi,<br><br></div>I need some help in expanding a hostrange as in: h[1-100].<a href="http://domain.com" target="_blank">domain.com</a> should get expanded into a list containing <a href="http://h1.domain.com" target="_blank">h1.domain.com</a> to <a href="http://h100.domain.com" target="_blank">h100.domain.com</a>. Is there a library that can do this for me? I also need to valid the range before I expand it, i.e., h[1*100].<a href="http://domain.com" target="_blank">domain.com</a> should not be accept, or other formats should not be accepted.<br>
</div></blockquote><div><br></div><div>You can loop on the range and create the list by appending strings created with the range using string substitution.  No library involved, just basic python language features.  As to the validation problem, I don't think you have defined it well enough to advise you on coding.<br>
<br></div><div>Why don't you specify exaction what is legal or not legal for your range, write the code, show us what you  have, and someone can help you further.  My guess is the code can all be written in maybe 20 lines or so. <br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<br>Thanks<br></div>
<br>--<br>
<a href="https://mail.python.org/mailman/listinfo/python-list" target="_blank">https://mail.python.org/mailman/listinfo/python-list</a><br>
<br></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>