coolair
V2EX  ›  问与答

有没有办法生成所有的ipv4地址?当然,不包括局域网的那些个段。

  •  
  •   coolair · Jan 25, 2014 · 2896 views
    This topic created in 4683 days ago, the information mentioned may be changed or developed.
    7 replies  •  1970-01-01 08:00:00 +08:00
    binux
    binux
    Jan 25, 2014
    2
    for i in irange(0, 0xffffffff):
    __if i & 0xa000000 or i & 0xac100000 or i & 0xc0a80000: continue
    __print i
    coolair
    coolair
    OP
    Jan 26, 2014
    3
    @yfdyh000 这个是啥?怎么用?
    @binux 好高端的样子……python么?
    coolair
    coolair
    OP
    Jan 26, 2014
    4
    @binux
    哥们,跑不了啊。
    那个是irange?应该是range吧……
    换成range提示:
    OverflowError: range() result has too many items
    tywtyw2002
    tywtyw2002
    Jan 26, 2014 via iPhone
    5
    换成xrang
    coolair
    coolair
    OP
    Jan 26, 2014
    6
    @tywtyw2002 也不行,提示:
    OverflowError: Python int too large to convert to C long
    yfdyh000
    yfdyh000
    Jan 27, 2014
    7
    @coolair 不知道你要啥结果,所以给个已分配范围表供参考。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1819 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 01:46 · PVG 09:46 · LAX 17:46 · JFK 20:46
    ♥ Do have faith in what you're doing.