当前位置 : 主页 > 编程语言 > python >

一段python代码 熟悉语法

来源:互联网 收集:自由互联 发布时间:2022-07-20
# -*- coding: gbk -*- #!/usr/bin/python import codecs #poem='''111111''' f1 = open('统计.txt', 'w') XiTongTouFang_sum = 0 XiTongXiaoHao_sum = 0 XTNLDSD_sum = 0#包裹获得 交易获得 金银交易所获得 拍卖行获得 物品交易所获
# -*- coding: gbk -*-
#!/usr/bin/python
import codecs
#poem='''111111'''
f1 = open('统计.txt', 'w') XiTongTouFang_sum = 0
XiTongXiaoHao_sum = 0
XTNLDSD_sum = 0#包裹获得 交易获得 金银交易所获得 拍卖行获得 物品交易所获得
XTNLDZC_sum = 0#系统内流动支出XTTF_top20 = {}
XTXH_top20 = {}
XTNLDSD_top20 = {}
XTNLDZC_top20 = {} idMap={}
chazhi_top20={}
f = codecs.open('D:\gamecoin.log.2012-09-13', 'r', 'utf-8')
while True:
try:
line = f.readline()
if len(line) == 0:
break
if line[20:26] == '[任务奖励]' or line[20:26] == '[道具奖励]' or line[20:26] == '[卖出获得]':
XiTongTouFang_sum = XiTongTouFang_sum + int(line[line.rfind('[') + 1:line.rfind(']')])
temp_sum = '%d' % XiTongTouFang_sum
if XTTF_top20.__contains__(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]):
XTTF_top20[line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]] = XTTF_top20.get(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]) + int(line[line.rfind('[') + 1:line.rfind(']')])
else:
XTTF_top20[ line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]] = int(line[line.rfind('[') + 1:line.rfind(']')])


if line[20:26] == '[合成支出]' or line[20:27] == '[买物品消耗]' or line[20:26] == '[强化支出]':
XiTongXiaoHao_sum = XiTongXiaoHao_sum + int(line[line.rfind('[') + 1:line.rfind(']')])
temp_sum2 = '%d' % XiTongXiaoHao_sum
if XTXH_top20.__contains__(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]):
XTXH_top20[line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]] = XTXH_top20.get(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]) + int(line[line.rfind('[') + 1:line.rfind(']')])
else:
XTXH_top20[ line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]] = int(line[line.rfind('[') + 1:line.rfind(']')])

if line[20:26] == '[包裹获得]' or line[20:26] == '[交易获得]' or line[20:29] == '[金银交易所获得]' or line[20:27] == '[拍卖行获得]' or line[20:29] == '[物品交易所获得]':
XTNLDSD_sum = XTNLDSD_sum + int(line[line.rfind('[') + 1:line.rfind(']')])
temp_sum3 = '%d' % XTNLDSD_sum
if XTNLDSD_top20.__contains__(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]):
XTNLDSD_top20[line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]] = XTNLDSD_top20.get(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]) + int(line[line.rfind('[') + 1:line.rfind(']')])
else:
XTNLDSD_top20[ line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]] = int(line[line.rfind('[') + 1:line.rfind(']')])

if line[20:26] == '[包裹支出]' or line[20:26] == '[交易支出]' or line[20:27] == '[拍卖行支出]' or line[20:29] == '[物品交易所支出]' :
XTNLDZC_sum = XTNLDZC_sum + int(line[line.rfind('[') + 1:line.rfind(']')])
temp_sum4 = '%d' % XTNLDZC_sum
if XTNLDZC_top20.__contains__(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]):
XTNLDZC_top20[line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]] = XTNLDZC_top20.get(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]) + int(line[line.rfind('[') + 1:line.rfind(']')])
else:
XTNLDZC_top20[ line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]] = int(line[line.rfind('[') + 1:line.rfind(']')])
chazhi_top20[ line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]]=XTNLDSD_top20.get(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))])-XTNLDZC_top20.get(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))])

except:
continue#系统投放
array1 = []
array2 = []for key in XTTF_top20.keys():
try:


array1.append(key)
array2.append(XTTF_top20[key])
except:
continue#bubble sort
for i in range(array1.__len__() - 1):
for j in range(array1.__len__() - 1):
if array2[j] < array2[j + 1]:
temp1 = array1[j]
array1[j] = array1[j + 1]
array1[j + 1] = temp1
temp2 = array2[j]
array2[j] = array2[j + 1]
array2[j + 1] = temp2#系统消耗
array3 = []
array4 = []for key in XTXH_top20.keys():
try:

array3.append(key)
array4.append(XTXH_top20[key])
except:
continue#bubble sort
for i in range(array3.__len__() - 1):
for j in range(array3.__len__() - 1):
if array4[j] < array4[j + 1]:
temp1 = array3[j]
array3[j] = array3[j + 1]
array3[j + 1] = temp1
temp2 = array4[j]
array4[j] = array4[j + 1]
array4[j + 1] = temp2
#系统流动所得
array5 = []
array6 = []for key in XTNLDSD_top20.keys():
try:

array5.append(key)
array6.append(XTNLDSD_top20[key])
except:
continue#bubble sort
for i in range(array5.__len__() - 1):
for j in range(array5.__len__() - 1):
if array6[j] < array6[j + 1]:
temp1 = array5[j]
array5[j] = array5[j + 1]
array5[j + 1] = temp1
temp2 = array6[j]
array6[j] = array6[j + 1]
array6[j + 1] = temp2 #系统内流动支出
array7 = []
array8 = []for key in XTNLDZC_top20.keys():
try:

array7.append(key)
array8.append(XTNLDZC_top20[key])
except:
continue#bubble sort
for i in range(array7.__len__() - 1):
for j in range(array7.__len__() - 1):
if array8[j] < array8[j + 1]:
temp1 = array7[j]
array7[j] = array7[j + 1]
array7[j + 1] = temp1
temp2 = array8[j]
array8[j] = array8[j + 1]
array8[j + 1] = temp2
array100=[]
array101=[]
for key in chazhi_top20.keys():
try:

array100.append(key)
array101.append(chazhi_top20[key])
except:
continuefor i in range(array100.__len__() - 1):
for j in range(array100.__len__() - 1):
if array101[j] < array101[j + 1]:
temp1 = array100[j]
array100[j] = array100[j + 1]
array100[j + 1] = temp1
temp2 = array101[j]
array101[j] = array101[j + 1]
array101[j + 1] = temp2 #for i in range(array100.__len__()):
# try:
# temp= '%d' % array101[i]
# print(array100[i]+temp)
# except:
# continue
#得到id
f3 = codecs.open('D:\gamecoin.log.2012-09-13', 'r', 'utf-8')
while True:
try:
line = f3.readline()
if len(line) == 0:
break
# if XTTF_top20.__contains__(line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]):
# print( line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))] )
print(line[ line.find('[',24)+1 : line.find(']',line.find('[',24)+1 ) ])# : line.rfind(']', 0, line._len_()- line[line.rfind('[') + 1:line.rfind(']')].__len__() - line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))].__len__() -4 ) ])
idMap[line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))] ]= line[ line.find('[',24)+1 : line.find(']',line.find('[',24)+1 ) ]
except:
continue


array_top20_RWJL = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_DJJL = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_MCHD = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]array_top20_HCZC = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_MWPXH = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_QHZC = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]#包裹获得 交易获得 金银交易所获得 拍卖行获得 物品交易所获得
array_top20_BGHD = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_JYHD = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_JYJYSHD = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_PMHHD = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_WPJYSHD = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]#'[包裹支出]'[交易支出]' '[拍卖行支出]' '[物品交易所支出]'
array_top20_BGZC = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_JYZC = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_PMHZC = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
array_top20_WPJYSZC = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
f2 = codecs.open('D:\gamecoin.log.2012-09-13', 'r', 'utf-8')
while True:
try:
line = f2.readline()
if len(line) == 0:
break
for i in range(20):
if line[20:26] == '[任务奖励]' and array1[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_RWJL[i] = array_top20_RWJL[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:26] == '[道具奖励]' and array1[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_DJJL[i] = array_top20_DJJL[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:26] == '[卖出获得]' and array1[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_MCHD[i] = array_top20_MCHD[i] + int(line[line.rfind('[') + 1:line.rfind(']')])

for i in range(20):
if line[20:26] == '[合成支出]' and array3[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_HCZC[i] = array_top20_HCZC[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:27] == '[买物品消耗]' and array3[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_MWPXH[i] = array_top20_MWPXH[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:26] == '[强化支出]' and array3[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_QHZC[i] = array_top20_QHZC[i] + int(line[line.rfind('[') + 1:line.rfind(']')])


for i in range(20):
if line[20:26] == '[包裹获得]' and array5[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_BGHD[i] = array_top20_BGHD[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:26] == '[交易获得]' and array5[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_JYHD[i] = array_top20_JYHD[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:29] == '[金银交易所获得]' and array5[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_JYJYSHD[i] = array_top20_JYJYSHD[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:27] == '[拍卖行获得]' and array5[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_PMHHD[i] = array_top20_PMHHD[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:29] == '[物品交易所获得]' and array5[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_WPJYSHD[i] = array_top20_WPJYSHD[i] + int(line[line.rfind('[') + 1:line.rfind(']')])

for i in range(20):
if line[20:26] == '[包裹支出]' and array7[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_BGZC[i] = array_top20_BGZC[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:26] == '[交易支出]' and array7[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_JYZC[i] = array_top20_JYZC[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:27] == '[拍卖行支出]' and array7[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_PMHZC[i] = array_top20_PMHZC[i] + int(line[line.rfind('[') + 1:line.rfind(']')])
for i in range(20):
if line[20:29] == '[物品交易所支出]' and array7[i] == line[line.rfind('[', 28, line.rfind('[')) + 1:line.rfind(']', 28, line.rfind('['))]:
array_top20_WPJYSZC[i] = array_top20_WPJYSZC[i] + int(line[line.rfind('[') + 1:line.rfind(']')])






except:
continue #print(array_top20_RWJL[i])





f1.write('系统投放总和' + temp_sum + '\n')
f1.write('系统消耗总和' + temp_sum2 + '\n')
f1.write('系统内流动所得总和' + temp_sum3 + '\n')
f1.write('系统内流动支出总和' + temp_sum4 + '\n')
f1.write(' 任务奖励 道具奖励 卖出获得 个人总和 系统投放top20\n')
for i in range(20):
try:
temp11 = '%d' % array2[i]
temp22 = '%d' % array_top20_RWJL[i]
temp33 = '%d' % array_top20_DJJL[i]
temp44 = '%d' % array_top20_MCHD[i]
if temp11.__len__()>3 and temp11.__len__()<=6:
temp11= temp11[0:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]
elif temp11.__len__()>6:
temp11= temp11[0:temp11.__len__()-6] + ','+temp11[temp11.__len__()-6:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]

if temp22.__len__()>3 and temp22.__len__()<=6:
temp22= temp22[0:temp22.__len__()-3]+','+ temp22[temp22.__len__()-3:temp22.__len__()]
elif temp22.__len__()>6:
temp22= temp22[0:temp22.__len__()-6] + ','+temp22[temp22.__len__()-6:temp22.__len__()-3]+','+ temp22[temp22.__len__()-3:temp22.__len__()]

if temp33.__len__()>3 and temp33.__len__()<=6:
temp33= temp33[0:temp33.__len__()-3]+','+ temp33[temp33.__len__()-3:temp33.__len__()]
elif temp33.__len__()>6:
temp33= temp33[0:temp33.__len__()-6] + ','+temp33[temp33.__len__()-6:temp33.__len__()-3]+','+ temp33[temp33.__len__()-3:temp33.__len__()]

if temp44.__len__()>3 and temp44.__len__()<=6:
temp44= temp44[0:temp44.__len__()-3]+','+ temp44[temp44.__len__()-3:temp44.__len__()]
elif temp44.__len__()>6:
temp44= temp44[0:temp44.__len__()-6] + ','+temp44[temp44.__len__()-6:temp44.__len__()-3]+','+ temp44[temp44.__len__()-3:temp44.__len__()]



if temp11.__len__() == 1:
temp11 = " " + temp11
if temp22.__len__() == 1:
temp22 = " " + temp22
if temp33.__len__() == 1:
temp33 = " " + temp33
if temp44.__len__() == 1:
temp44 = " " + temp44

if temp11.__len__() == 2:
temp11 = " " + temp11
if temp22.__len__() == 2:
temp22 = " " + temp22
if temp33.__len__() == 2:
temp33 = " " + temp33
if temp44.__len__() == 2:
temp44 = " " + temp44

if temp11.__len__() == 3:
temp11 = " " + temp11
if temp22.__len__() == 3:
temp22 = " " + temp22
if temp33.__len__() == 3:
temp33 = " " + temp33
if temp44.__len__() == 3:
temp44 = " " + temp44

if temp11.__len__() == 4:
temp11 = " " + temp11
if temp22.__len__() == 4:
temp22 = " " + temp22
if temp33.__len__() == 4:
temp33 = " " + temp33
if temp44.__len__() == 4:
temp44 = " " + temp44

if temp11.__len__() == 5:
temp11 = " " + temp11
if temp22.__len__() == 5:
temp22 = " " + temp22
if temp33.__len__() == 5:
temp33 = " " + temp33
if temp44.__len__() == 5:
temp44 = " " + temp44

if temp11.__len__() == 6:
temp11 = " " + temp11
if temp22.__len__() == 6:
temp22 = " " + temp22
if temp33.__len__() == 6:
temp33 = " " + temp33
if temp44.__len__() == 6:
temp44 = " " + temp44

if temp11.__len__() == 7:
temp11 = " " + temp11
if temp22.__len__() == 7:
temp22 = " " + temp22
if temp33.__len__() == 7:
temp33 = " " + temp33
if temp44.__len__() == 7:
temp44 = " " + temp44
f1.write(temp22 + " " + temp33 + " " + temp44 + " " + temp11 + " " + array1[i] +" "+ idMap.get( array1[i]) +"\n")
except:
continue f1.write('\n')
f1.write(' 合成支出 买物品消耗 强化支出 个人总和 系统消耗top20\n')
for i in range(20):
try:
temp11 = '%d' % array4[i]
temp22 = '%d' % array_top20_HCZC[i]
temp33 = '%d' % array_top20_MWPXH[i]
temp44 = '%d' % array_top20_QHZC[i]


if temp11.__len__()>3 and temp11.__len__()<=6:
temp11= temp11[0:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]
elif temp11.__len__()>6:
temp11= temp11[0:temp11.__len__()-6] + ','+temp11[temp11.__len__()-6:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]

if temp22.__len__()>3 and temp22.__len__()<=6:
temp22= temp22[0:temp22.__len__()-3]+','+ temp22[temp22.__len__()-3:temp22.__len__()]
elif temp22.__len__()>6:
temp22= temp22[0:temp22.__len__()-6] + ','+temp22[temp22.__len__()-6:temp22.__len__()-3]+','+ temp22[temp22.__len__()-3:temp22.__len__()]

if temp33.__len__()>3 and temp33.__len__()<=6:
temp33= temp33[0:temp33.__len__()-3]+','+ temp33[temp33.__len__()-3:temp33.__len__()]
elif temp33.__len__()>6:
temp33= temp33[0:temp33.__len__()-6] + ','+temp33[temp33.__len__()-6:temp33.__len__()-3]+','+ temp33[temp33.__len__()-3:temp33.__len__()]

if temp44.__len__()>3 and temp44.__len__()<=6:
temp44= temp44[0:temp44.__len__()-3]+','+ temp44[temp44.__len__()-3:temp44.__len__()]
elif temp44.__len__()>6:
temp44= temp44[0:temp44.__len__()-6] + ','+temp44[temp44.__len__()-6:temp44.__len__()-3]+','+ temp44[temp44.__len__()-3:temp44.__len__()]



if temp11.__len__() == 1:
temp11 = " " + temp11
if temp22.__len__() == 1:
temp22 = " " + temp22
if temp33.__len__() == 1:
temp33 = " " + temp33
if temp44.__len__() == 1:
temp44 = " " + temp44

if temp11.__len__() == 2:
temp11 = " " + temp11
if temp22.__len__() == 2:
temp22 = " " + temp22
if temp33.__len__() == 2:
temp33 = " " + temp33
if temp44.__len__() == 2:
temp44 = " " + temp44

if temp11.__len__() == 3:
temp11 = " " + temp11
if temp22.__len__() == 3:
temp22 = " " + temp22
if temp33.__len__() == 3:
temp33 = " " + temp33
if temp44.__len__() == 3:
temp44 = " " + temp44

if temp11.__len__() == 4:
temp11 = " " + temp11
if temp22.__len__() == 4:
temp22 = " " + temp22
if temp33.__len__() == 4:
temp33 = " " + temp33
if temp44.__len__() == 4:
temp44 = " " + temp44

if temp11.__len__() == 5:
temp11 = " " + temp11
if temp22.__len__() == 5:
temp22 = " " + temp22
if temp33.__len__() == 5:
temp33 = " " + temp33
if temp44.__len__() == 5:
temp44 = " " + temp44

if temp11.__len__() == 6:
temp11 = " " + temp11
if temp22.__len__() == 6:
temp22 = " " + temp22
if temp33.__len__() == 6:
temp33 = " " + temp33
if temp44.__len__() == 6:
temp44 = " " + temp44

if temp11.__len__() == 7:
temp11 = " " + temp11
if temp22.__len__() == 7:
temp22 = " " + temp22
if temp33.__len__() == 7:
temp33 = " " + temp33
if temp44.__len__() == 7:
temp44 = " " + temp44
# temp111= temp11[temp11.__len__()-6:temp11.__len__()-3]+'.'+ temp11[temp.__len__()-3:temp.__len__()]
f1.write(temp22 + " " + temp33 + " " + temp44 + " " + temp11 + " " + array3[i] + " "+idMap[array3[i]]+"\n")
except:
continue
f1.write('\n')
f1.write(' 包裹获得 交易获得 金银交易所获得 拍卖行获得 物品交易所获得 个人总和 系统内流动所得top20\n')
for i in range(20):
try:
temp11 = '%d' % array6[i]
temp22 = '%d' % array_top20_BGHD[i]
temp33 = '%d' % array_top20_JYHD[i]
temp44 = '%d' % array_top20_JYJYSHD[i]
temp55 = '%d' % array_top20_PMHHD[i]
temp66 = '%d' % array_top20_WPJYSHD[i]


if temp11.__len__()>3 and temp11.__len__()<=6:
temp11= temp11[0:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]
elif temp11.__len__()>6:
temp11= temp11[0:temp11.__len__()-6] + ','+temp11[temp11.__len__()-6:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]

if temp22.__len__()>3 and temp22.__len__()<=6:
temp22= temp22[0:temp22.__len__()-3]+','+ temp22[temp22.__len__()-3:temp22.__len__()]
elif temp22.__len__()>6:
temp22= temp22[0:temp22.__len__()-6] + ','+temp22[temp22.__len__()-6:temp22.__len__()-3]+','+ temp22[temp22.__len__()-3:temp22.__len__()]

if temp33.__len__()>3 and temp33.__len__()<=6:
temp33= temp33[0:temp33.__len__()-3]+','+ temp33[temp33.__len__()-3:temp33.__len__()]
elif temp33.__len__()>6:
temp33= temp33[0:temp33.__len__()-6] + ','+temp33[temp33.__len__()-6:temp33.__len__()-3]+','+ temp33[temp33.__len__()-3:temp33.__len__()]

if temp44.__len__()>3 and temp44.__len__()<=6:
temp44= temp44[0:temp44.__len__()-3]+','+ temp44[temp44.__len__()-3:temp44.__len__()]
elif temp44.__len__()>6:
temp44= temp44[0:temp44.__len__()-6] + ','+temp44[temp44.__len__()-6:temp44.__len__()-3]+','+ temp44[temp44.__len__()-3:temp44.__len__()]


if temp55.__len__()>3 and temp55.__len__()<=6:
temp55= temp55[0:temp55.__len__()-3]+','+ temp55[temp55.__len__()-3:temp55.__len__()]
elif temp55.__len__()>6:
temp55= temp55[0:temp55.__len__()-6] + ','+temp55[temp55.__len__()-6:temp55.__len__()-3]+','+ temp55[temp55.__len__()-3:temp55.__len__()]

if temp66.__len__()>3 and temp66.__len__()<=6:
temp66= temp66[0:temp66.__len__()-3]+','+ temp66[temp66.__len__()-3:temp66.__len__()]
elif temp66.__len__()>6:
temp66= temp66[0:temp66.__len__()-6] + ','+temp66[temp66.__len__()-6:temp66.__len__()-3]+','+ temp66[temp66.__len__()-3:temp66.__len__()]




if temp11.__len__() == 1:
temp11 = " " + temp11
if temp22.__len__() == 1:
temp22 = " " + temp22
if temp33.__len__() == 1:
temp33 = " " + temp33
if temp44.__len__() == 1:
temp44 = " " + temp44
if temp55.__len__() == 1:
temp55 = " " + temp55
if temp66.__len__() == 1:
temp66 = " " + temp66


if temp11.__len__() == 2:
temp11 = " " + temp11
if temp22.__len__() == 2:
temp22 = " " + temp22
if temp33.__len__() == 2:
temp33 = " " + temp33
if temp44.__len__() == 2:
temp44 = " " + temp44
if temp55.__len__() == 2:
temp55 = " " + temp55
if temp66.__len__() == 2:
temp66 = " " + temp66



if temp11.__len__() == 3:
temp11 = " " + temp11
if temp22.__len__() == 3:
temp22 = " " + temp22
if temp33.__len__() == 3:
temp33 = " " + temp33
if temp44.__len__() == 3:
temp44 = " " + temp44
if temp55.__len__() == 3:
temp55 = " " + temp55
if temp66.__len__() == 3:
temp66 = " " + temp66


if temp11.__len__() == 4:
temp11 = " " + temp11
if temp22.__len__() == 4:
temp22 = " " + temp22
if temp33.__len__() == 4:
temp33 = " " + temp33
if temp44.__len__() == 4:
temp44 = " " + temp44
if temp55.__len__() == 4:
temp55 = " " + temp55
if temp66.__len__() == 4:
temp66 = " " + temp66



if temp11.__len__() == 5:
temp11 = " " + temp11
if temp22.__len__() == 5:
temp22 = " " + temp22
if temp33.__len__() == 5:
temp33 = " " + temp33
if temp44.__len__() == 5:
temp44 = " " + temp44
if temp55.__len__() == 5:
temp55 = " " + temp55
if temp66.__len__() == 5:
temp66 = " " + temp66



if temp11.__len__() == 6:
temp11 = " " + temp11
if temp22.__len__() == 6:
temp22 = " " + temp22
if temp33.__len__() == 6:
temp33 = " " + temp33
if temp44.__len__() == 6:
temp44 = " " + temp44
if temp55.__len__() == 6:
temp55 = " " + temp55
if temp66.__len__() == 6:
temp66 = " " + temp66


if temp11.__len__() == 7:
temp11 = " " + temp11
if temp22.__len__() == 7:
temp22 = " " + temp22
if temp33.__len__() == 7:
temp33 = " " + temp33
if temp44.__len__() == 7:
temp44 = " " + temp44
if temp55.__len__() == 7:
temp55 = " " + temp55
if temp66.__len__() == 7:
temp66 = " " + temp66
# temp111= temp11[temp11.__len__()-6:temp11.__len__()-3]+'.'+ temp11[temp.__len__()-3:temp.__len__()]
f1.write(temp22 + " " + temp33 + " " + temp44 + " " + temp55 + " " + temp66 + " " + temp11 + " " + array5[i] +" "+idMap[array5[i]]+ "\n")
except:
continue
f1.write('\n')
f1.write(' 包裹支出 交易支出 拍卖行支出 物品交易所支出 个人总和 系统内流动支出top20\n')
for i in range(20):
try:
temp11 = '%d' % array8[i]
temp22 = '%d' % array_top20_BGZC[i]
temp33 = '%d' % array_top20_JYZC[i]
temp44 = '%d' % array_top20_PMHZC[i]
temp55 = '%d' % array_top20_WPJYSZC[i]

if temp11.__len__()>3 and temp11.__len__()<=6:
temp11= temp11[0:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]
elif temp11.__len__()>6:
temp11= temp11[0:temp11.__len__()-6] + ','+temp11[temp11.__len__()-6:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]

if temp22.__len__()>3 and temp22.__len__()<=6:
temp22= temp22[0:temp22.__len__()-3]+','+ temp22[temp22.__len__()-3:temp22.__len__()]
elif temp22.__len__()>6:
temp22= temp22[0:temp22.__len__()-6] + ','+temp22[temp22.__len__()-6:temp22.__len__()-3]+','+ temp22[temp22.__len__()-3:temp22.__len__()]

if temp33.__len__()>3 and temp33.__len__()<=6:
temp33= temp33[0:temp33.__len__()-3]+','+ temp33[temp33.__len__()-3:temp33.__len__()]
elif temp33.__len__()>6:
temp33= temp33[0:temp33.__len__()-6] + ','+temp33[temp33.__len__()-6:temp33.__len__()-3]+','+ temp33[temp33.__len__()-3:temp33.__len__()]

if temp44.__len__()>3 and temp44.__len__()<=6:
temp44= temp44[0:temp44.__len__()-3]+','+ temp44[temp44.__len__()-3:temp44.__len__()]
elif temp44.__len__()>6:
temp44= temp44[0:temp44.__len__()-6] + ','+temp44[temp44.__len__()-6:temp44.__len__()-3]+','+ temp44[temp44.__len__()-3:temp44.__len__()]


if temp55.__len__()>3 and temp55.__len__()<=6:
temp55= temp55[0:temp55.__len__()-3]+','+ temp55[temp55.__len__()-3:temp55.__len__()]
elif temp55.__len__()>6:
temp55= temp55[0:temp55.__len__()-6] + ','+temp55[temp55.__len__()-6:temp55.__len__()-3]+','+ temp55[temp55.__len__()-3:temp55.__len__()]


if temp11.__len__() == 1:
temp11 = " " + temp11
if temp22.__len__() == 1:
temp22 = " " + temp22
if temp33.__len__() == 1:
temp33 = " " + temp33
if temp44.__len__() == 1:
temp44 = " " + temp44
if temp55.__len__() == 1:
temp55 = " " + temp55



if temp11.__len__() == 2:
temp11 = " " + temp11
if temp22.__len__() == 2:
temp22 = " " + temp22
if temp33.__len__() == 2:
temp33 = " " + temp33
if temp44.__len__() == 2:
temp44 = " " + temp44
if temp55.__len__() == 2:
temp55 = " " + temp55



if temp11.__len__() == 3:
temp11 = " " + temp11
if temp22.__len__() == 3:
temp22 = " " + temp22
if temp33.__len__() == 3:
temp33 = " " + temp33
if temp44.__len__() == 3:
temp44 = " " + temp44
if temp55.__len__() == 3:
temp55 = " " + temp55

if temp11.__len__() == 4:
temp11 = " " + temp11
if temp22.__len__() == 4:
temp22 = " " + temp22
if temp33.__len__() == 4:
temp33 = " " + temp33
if temp44.__len__() == 4:
temp44 = " " + temp44
if temp55.__len__() == 4:
temp55 = " " + temp55




if temp11.__len__() == 5:
temp11 = " " + temp11
if temp22.__len__() == 5:
temp22 = " " + temp22
if temp33.__len__() == 5:
temp33 = " " + temp33
if temp44.__len__() == 5:
temp44 = " " + temp44
if temp55.__len__() == 5:
temp55 = " " + temp55



if temp11.__len__() == 6:
temp11 = " " + temp11
if temp22.__len__() == 6:
temp22 = " " + temp22
if temp33.__len__() == 6:
temp33 = " " + temp33
if temp44.__len__() == 6:
temp44 = " " + temp44
if temp55.__len__() == 6:
temp55 = " " + temp55



if temp11.__len__() == 7:
temp11 = " " + temp11
if temp22.__len__() == 7:
temp22 = " " + temp22
if temp33.__len__() == 7:
temp33 = " " + temp33
if temp44.__len__() == 7:
temp44 = " " + temp44
if temp55.__len__() == 7:
temp55 = " " + temp55

# temp111= temp11[temp11.__len__()-6:temp11.__len__()-3]+'.'+ temp11[temp.__len__()-3:temp.__len__()]
f1.write(temp22 + " " + temp33 + " " + temp44 + " " + temp55 + " " + temp11 + " " + array7[i] + " "+idMap[array7[i]]+"\n")
except:
continue


f1.write('\n')
f1.write(' 系统内盈余top20\n')
for i in range(20):
try:
temp11 = '%d' % array101[i]


if temp11.__len__()>3 and temp11.__len__()<=6:
temp11= temp11[0:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]
elif temp11.__len__()>6:
temp11= temp11[0:temp11.__len__()-6] + ','+temp11[temp11.__len__()-6:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]


if temp11.__len__() == 1:
temp11 = " " + temp11


if temp11.__len__() == 2:
temp11 = " " + temp11



if temp11.__len__() == 3:
temp11 = " " + temp11



if temp11.__len__() == 4:
temp11 = " " + temp11




if temp11.__len__() == 5:
temp11 = " " + temp11




if temp11.__len__() == 6:
temp11 = " " + temp11




if temp11.__len__() == 7:
temp11 = " " + temp11


f1.write(temp11 + " " + array100[i] + " "+idMap[array100[i]]+"\n")
except:
continue
f1.write('\n')
f1.write(' 系统内盈余top20\n')
for i in range(20):
try:
temp11 = '%d' % array101[array101.__len__()-i]

if temp11.__len__()>3 and temp11.__len__()<=6:
temp11= temp11[0:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]
elif temp11.__len__()>6:
temp11= temp11[0:temp11.__len__()-6] + ','+temp11[temp11.__len__()-6:temp11.__len__()-3]+','+ temp11[temp11.__len__()-3:temp11.__len__()]



if temp11.__len__() == 1:
temp11 = " " + temp11


if temp11.__len__() == 2:
temp11 = " " + temp11



if temp11.__len__() == 3:
temp11 = " " + temp11



if temp11.__len__() == 4:
temp11 = " " + temp11




if temp11.__len__() == 5:
temp11 = " " + temp11




if temp11.__len__() == 6:
temp11 = " " + temp11




if temp11.__len__() == 7:
temp11 = " " + temp11

if temp11.__len__() == 8:
temp11 = " " + temp11



f1.write(temp11 + " " + array100[array101.__len__()-i] + " "+idMap[array100[array101.__len__()-i]]+"\n")
except:
continue

f2.close()
f1.close()
f.close()
上一篇:【推荐】10个好用的Python集成开发环境!
下一篇:没有了
网友评论