break
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
32
33
34
35
36
37
38
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# line="-rw-rw-rw- 1 user group 1000699 Jan 23 17:36 ftp.pdf"
line
=
"drw-rw-rw- 1 user group 1000699 Jan 23 2017 ftp.pdf"
def
testa(line):
if
' 2016 '
in
line:
pos
=
line.rfind(
' 2016 '
)
+
1
dateceshi
=
"down"
print
"pos2016"
, pos
else
:
months
=
[
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
]
for
i
in
months:
if
i
in
line
and
' 2016 '
not
in
line
and
' 2017 '
not
in
line
and
':'
in
line:
pos
=
line.rfind(
':'
)
print
"2017"
, pos
dateceshi
=
"down"
break
elif
i
in
line
and
' 2017 '
in
line:
pos
=
line.rfind(
' 2017 '
)
+
1
print
"2017"
, pos
dateceshi
=
"down"
break
else
:
# pos = line.rfind(':')
# dateceshi = "nodown"
return
while
(line[pos] !
=
' '
):
pos
+
=
1
while
(line[pos]
=
=
' '
):
pos
+
=
1
print
pos
file_arr
=
[line[
0
], line[pos:]]
print
file_arr
testaa
=
testa(line)
|
return
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
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# line="-rw-rw-rw- 1 user group 1000699 Jan 23 17:36 ftp.pdf"
line
=
"drw-rw-rw- 1 user group 1000699 Jun 23 2017 ftp.pdf"
def
testa(line):
if
' 2016 '
in
line:
pos
=
line.rfind(
' 2016 '
)
+
1
dateceshi
=
"down"
print
"pos2016"
, pos
else
:
months
=
[
'Jan'
,
'Feb'
,
'Mar'
,
'Apr'
]
for
i
in
months:
if
i
in
line
and
' 2016 '
not
in
line
and
' 2017 '
not
in
line
and
':'
in
line:
pos
=
line.rfind(
':'
)
print
"2017"
, pos
file_arr
=
test2(pos, line)
return
file_arr
dateceshi
=
"down"
elif
i
in
line
and
' 2017 '
in
line:
pos
=
line.rfind(
' 2017 '
)
+
1
print
"20172"
, pos
file_arr
=
test2(pos, line)
return
file_arr
dateceshi
=
"down"
else
:
return
def
test2(pos,line):
while
(line[pos] !
=
' '
):
pos
+
=
1
while
(line[pos]
=
=
' '
):
pos
+
=
1
print
pos
file_arr
=
[line[
0
], line[pos:]]
return
file_arr
testaa
=
testa(line)
print
testaa
|