FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
vcs/_4.python/__code/__tmp_code/suff.py at master · bunshue/vcs · GitHub
bunshue
/
vcs
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
3
Code
Issues
0
Pull requests
4
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
vcs
/
_4.python
/
__code
/
__tmp_code
/
suff.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (20 loc) · 602 Bytes
Breadcrumbs
vcs
/
_4.python
/
__code
/
__tmp_code
/
suff.py
Copy path
File metadata and controls
29 lines (20 loc) · 602 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
'''
計算不同類型檔案出現次數
'''
import
sys
def
get_suffix
(
filename
):
name
,
sep
,
suff
=
filename
.
rpartition
(
'.'
)
return
sep
+
suff
if
sep
else
''
filename1
=
'D:/_git/vcs/_1.data/______test_files1/picture1.jpg'
filename2
=
'D:/_git/vcs/_1.data/______test_files1/file2.txt'
files
=
[
filename1
,
filename2
]
suffixes
=
{}
for
filename
in
files
:
suff
=
get_suffix
(
filename
)
suffixes
.
setdefault
(
suff
, []).
append
(
filename
)
for
suff
,
filenames
in
sorted
(
suffixes
.
items
()):
print
(
repr
(
suff
),
len
(
filenames
))
print
(
'files'
)
print
(
files
)
print
(
'suffixes'
)
print
(
suffixes
)
Back
|
FazBrowse Home
|
New Git URL