Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54900 > unrolled thread

Re: Hostrange expansion

Started byJoel Goldstick <joel.goldstick@gmail.com>
First post2013-09-27 13:26 -0400
Last post2013-09-27 13:26 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Hostrange expansion Joel Goldstick <joel.goldstick@gmail.com> - 2013-09-27 13:26 -0400

#54900 — Re: Hostrange expansion

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2013-09-27 13:26 -0400
SubjectRe: Hostrange expansion
Message-ID<mailman.386.1380302806.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On Fri, Sep 27, 2013 at 11:32 AM, Sam Giraffe <sam@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web