#!/usr/bin/python
# -*- coding: UTF-8 -*-
#地图生成
from file_io.long_file import longfile
def baidumap(name,index,max):
top = '''
<?xml version="1.0" encoding="UTF-8"?>
'''
content = ''
for i in range(index, max):
con = 'http://loooooong.com/p-{}.htmldaily0.8'
index = i
content = content + con.format(index)
end = '''
'''
lf = longfile(file_url='你的目录\loooooong.com\setmap_{}.xml'.format(name),
file_str='{}{}{}'.format(top, content, end))
lf.write()
baidumap(1,1,5000)
baidumap(2,5001,10000)
baidumap(3,10001,15000)
baidumap(4,15001,20000)
baidumap(5,20001,23105)
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#文件操作
class longfile(object):
'''
'''
def __init__(self, file_url=None, file_str=None):
'''
:param file_url:
:param file_str:
'''
self.file_url = file_url
self.file_str = file_str
def write(self):
# 打开一个文件
fo = open(self.file_url, "w")
fo.write(self.file_str)
# 关闭打开的文件
fo.close()