2010-03-11 18:53:45 -04:00
|
|
|
#! /usr/bin/env python3
|
1991-06-04 17:36:54 -03:00
|
|
|
|
|
|
|
# suff
|
|
|
|
#
|
|
|
|
# show different suffixes amongst arguments
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
2010-08-09 09:24:20 -03:00
|
|
|
|
1991-06-04 17:36:54 -03:00
|
|
|
def main():
|
2001-01-17 04:48:39 -04:00
|
|
|
files = sys.argv[1:]
|
|
|
|
suffixes = {}
|
2003-05-13 15:14:25 -03:00
|
|
|
for filename in files:
|
|
|
|
suff = getsuffix(filename)
|
2010-08-09 09:24:20 -03:00
|
|
|
suffixes.setdefault(suff, []).append(filename)
|
|
|
|
for suff, filenames in sorted(suffixes.items()):
|
|
|
|
print(repr(suff), len(filenames))
|
|
|
|
|
1991-06-04 17:36:54 -03:00
|
|
|
|
2003-05-13 15:14:25 -03:00
|
|
|
def getsuffix(filename):
|
2010-08-09 09:24:20 -03:00
|
|
|
name, sep, suff = filename.rpartition('.')
|
|
|
|
return sep + suff if sep else ''
|
|
|
|
|
1991-06-04 17:36:54 -03:00
|
|
|
|
2004-08-09 14:27:55 -03:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|