diff options
author | Guido van Rossum <guido@python.org> | 1991-06-04 20:36:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-06-04 20:36:54 (GMT) |
commit | ec758ead391daa2ce0e5697aa0e67ec3ba0f37af (patch) | |
tree | 7f2d186afd41d797882d5b5be3330e921804ebe9 /Tools/scripts/suff.py | |
parent | 0481447f4135c11d42ae25f55696af8e8d52fe74 (diff) | |
download | cpython-ec758ead391daa2ce0e5697aa0e67ec3ba0f37af.zip cpython-ec758ead391daa2ce0e5697aa0e67ec3ba0f37af.tar.gz cpython-ec758ead391daa2ce0e5697aa0e67ec3ba0f37af.tar.bz2 |
Initial revision
Diffstat (limited to 'Tools/scripts/suff.py')
-rwxr-xr-x | Tools/scripts/suff.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Tools/scripts/suff.py b/Tools/scripts/suff.py new file mode 100755 index 0000000..7fda113 --- /dev/null +++ b/Tools/scripts/suff.py @@ -0,0 +1,29 @@ +#! /usr/local/python + +# suff +# +# show different suffixes amongst arguments + +import sys + +def main(): + files = sys.argv[1:] + suffixes = {} + for file in files: + suff = getsuffix(file) + if not suffixes.has_key(suff): + suffixes[suff] = [] + suffixes[suff].append(file) + keys = suffixes.keys() + keys.sort() + for suff in keys: + print `suff`, len(suffixes[suff]) + +def getsuffix(file): + suff = '' + for i in range(len(file)): + if file[i] = '.': + suff = file[i:] + return suff + +main() |