Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

0neday/python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

29 Commits

Repository files navigation

get NanJing IP

示例代码

import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import os
from ipip import IP
from ipip import IPX
f = open("jiangsu.txt")
for line in f:	
	IP.load(os.path.abspath("17monipdb.dat"))
	tmpaddress = IP.find(line).split()
	if len(tmpaddress) == 3:
		address = tmpaddress[2]
		if address == '南京':
			fout = open('out.txt','a') 
			fout.write(line)
f.close()
fout.close()

使用说明

修改 if address == '南京': 

执行

python main.py 

输出

out.txt 

github

全球 IPv4 地址归属地数据库

About

get Nanjing IP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%

AltStyle によって変換されたページ (->オリジナル) /