选择ip地址

有人能帮帮我吗?我想在我的电脑运行完后找出IP地址
与互联网相连.
所有这些都应该在答录机上起作用.当连接到
存在,则答录机应该
告诉我IP地址.
我认为,问题在第22行,因为当我设置一个名为
IP_ADDRESS(例如123.456.789.987)它起作用了!
1 def interetDialin(Call,Curr_User,CONFIG):
2 zielhost="62.104.217.40"
3接口="ippp0"
4#建立联系
5 c_status=os.system("ping-w 1"+zielhost)
6次计数=1次
7#等待连接30秒
8 While((c_status!=0)and(count<30)):
9 c_status=os.system("ping-w 1"+zielhost)
10个计数+=1个
11#IP-Address输出
12如果(c_status==0):
13个cmd=os.popen('LANG=""/sbin/ifconfig'+interface)
14行=cmd.readines()
15 cmd.Close()
16表示行中的l:
17 index=string.find(l,"net addr:")
18 IF(索引!=-1):
19索引+=10
20 rindex=字符串.find(l,"",index)
21#问题是这样的:
22 IP地址=l[索引:r索引]
23个
24 cs_helpers.sayNumber(Call,IP_Address,Curr_User,CONFIG)
THX
向您致敬,
亚历克斯

# 回答1


On Mon,16 Feb 2004 13:19:22+0100,Alexander FöDisch
写道:
关于以下几点:
192.168.1.2
?
--http://www.homepages.lu/pu/

标签: python

添加新评论