FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
learn-python/testmongo.py at master · bcys/learn-python · GitHub
bcys
/
learn-python
Public
forked from
tanteng/learn-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
learn-python
/
testmongo.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (23 loc) · 721 Bytes
Breadcrumbs
learn-python
/
testmongo.py
Copy path
File metadata and controls
31 lines (23 loc) · 721 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding:utf-8 -*-
from
pymongo
import
MongoClient
import
time
import
re
import
os
import
gridfs
import
sys
client
=
MongoClient
(
'mongodb://192.168.6.212:27017/send_excel'
)
db
=
client
.
js_send_excel
fs
=
gridfs
.
GridFS
(
db
)
files
=
fs
.
find
()
time_start
=
time
.
clock
()
print
(
'总数:'
,
files
.
count
())
count
=
0
for
ffle
in
files
:
filename
=
ffle
.
filename
m
=
re
.
match
(
r'发货订单'
,
filename
)
if
m
and
filename
.
find
(
'xls'
)
>
0
and
not
os
.
path
.
isfile
(
'./excel/'
+
filename
):
with
open
(
'./excel2/'
+
filename
,
'wb'
)
as
f1
:
f1
.
write
(
ffle
.
read
())
count
+=
1
print
(
'执行时间{0}秒'
.
format
(
time
.
clock
()
-
time_start
))
print
(
'本次更新{0}个文档'
.
format
(
count
))
Back
|
FazBrowse Home
|
New Git URL