On Fri, Sep 27, 2013 at 11:32 AM, Sam Giraffe <s...@giraffetech.biz> wrote:
> Hi, > > I need some help in expanding a hostrange as in: h[1-100].domain.comshould > get expanded into a list containing > h1.domain.com to h100.domain.com. 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]. > domain.com should not be accept, or other formats should not be accepted. > 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. 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. > > Thanks > > -- > https://mail.python.org/mailman/listinfo/python-list > > -- Joel Goldstick http://joelgoldstick.com
-- https://mail.python.org/mailman/listinfo/python-list