IP地址 [英] Ip address
问题描述
如何获取我的IP地址?
cmd.exe中的
我只需输入ipconfig即可然后打印:
...
IP地址。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 :192.168.1.10
...
我怎么能在python中做到这一点?
Scripter47写道:
如何获取我的IP地址?
cmd.exe中的
我只需输入ipconfig然后打印:
...
IP地址。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 :192.168.1.10
...
我怎么能在python中做到这一点?
#v +
python -c''import re,urllib; print re.findall("< title> Your IP:(。+?)< / title>",urllib.urlopen(" http://myip.dk/")。read())[ 0]''
#v-
干杯,
-
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
Klaus Alexander Seistrup skrev:
Scripter47写道:
>我如何获取我的IP地址?
在cmd.exe中我只需输入ipconfig即可然后打印:
...
IP地址。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 :192.168.1.10
...
我怎么能在python中做到这一点?
#v +
python -c''import re,urllib; print re.findall("< title> Your IP:(。+?)< / title>",urllib.urlopen(" http://myip.dk/")。read())[ 0]''
#v-
干杯,
Hmm那么你需要互联网连接。没有那个我能做到吗? '
它也不起作用:(
Scripter47写道:
< blockquote class =post_quotes>
> python -c''import re,urllib; print re.findall("< title> Your IP:(。+?) < / title>",urllib.urlopen(" http://myip.dk/")。read())[0]''
$ b $ H那么你需要互联网连接。
这就是IP地址的用途......
我可以不这样做吗?
也许你可以使用
中提到的方法 http://mail.python.org/pipermail/pyt...st/009153.html
它也不起作用:(
适用于我:
#v +
klaus @ home:〜
How do i get my ip address?
in cmd.exe i just type "ipconfig" then it prints:
...
IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10
...
how can i do that in python??
Scripter47 wrote:
How do i get my ip address?
in cmd.exe i just type "ipconfig" then it prints:
...
IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10
...
how can i do that in python??#v+
python -c ''import re, urllib; print re.findall("<title>Your IP: (.+?)</title>", urllib.urlopen("http://myip.dk/").read())[0]''
#v-
Cheers,
--
Klaus Alexander Seistrup
http://klaus.seistrup.dk/
Klaus Alexander Seistrup skrev:Scripter47 wrote:
>How do i get my ip address?
in cmd.exe i just type "ipconfig" then it prints:
...
IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10
...
how can i do that in python??
#v+
python -c ''import re, urllib; print re.findall("<title>Your IP: (.+?)</title>", urllib.urlopen("http://myip.dk/").read())[0]''
#v-
Cheers,
Hmm then you need Internet connecting. can i do it without that? ′
and it doesn''t work either :(
Scripter47 wrote:
>python -c ''import re, urllib; print re.findall("<title>Your IP: (.+?)</title>", urllib.urlopen("http://myip.dk/").read())[0]''
Hmm then you need Internet connecting.That''s what IP adresses are for...
can i do it without that?Perhaps you could use the method mentioned in
http://mail.python.org/pipermail/pyt...st/009153.html
and it doesn''t work either :(Works for me:
#v+
klaus@home:~
这篇关于IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!