File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 1+ # -*- coding:utf-8 -*-
2+
13from pymongo import MongoClient
2- import gridfs
34import time
45import re
56import os
7+ import gridfs
68import sys
79
8- client = MongoClient ('mongodb://192.168.1 .22:27017/excel ' )
10+ client = MongoClient ('mongodb://m_user:m_user_027@ 192.168.5 .22:27017/js_send_excel ' )
911db = client .js_send_excel
1012fs = gridfs .GridFS (db )
13+
1114files = fs .find ()
1215
1316time_start = time .clock ()
1417print ('总数:' , files .count ())
18+ count = 0
1519
1620for ffle in files :
1721 filename = ffle .filename
22+
1823 m = re .match (r'发货订单' , filename )
1924
20- if m and filename .find ('. xls' ) > 0 and not os .path .isfile ('./excel/' + filename ):
21- with open ('./excel /' + filename , 'wb' ) as f1 :
25+ if m and filename .find ('xls' ) > 0 and not os .path .isfile ('./excel/' + filename ):
26+ with open ('./excel2 /' + filename , 'wb' ) as f1 :
2227 f1 .write (ffle .read ())
28+ count += 1
2329
24- print ('执行时间{0}秒' .format (time .clock () - time_start ))
30+ print ('执行时间{0}秒' .format (time .clock () - time_start ))
31+ print ('本次更新{0}个文档' .format (count ))
You can’t perform that action at this time.
0 commit comments