summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/suff.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-06-04 20:36:54 (GMT)
committerGuido van Rossum <guido@python.org>1991-06-04 20:36:54 (GMT)
commitec758ead391daa2ce0e5697aa0e67ec3ba0f37af (patch)
tree7f2d186afd41d797882d5b5be3330e921804ebe9 /Tools/scripts/suff.py
parent0481447f4135c11d42ae25f55696af8e8d52fe74 (diff)
downloadcpython-ec758ead391daa2ce0e5697aa0e67ec3ba0f37af.zip
cpython-ec758ead391daa2ce0e5697aa0e67ec3ba0f37af.tar.gz
cpython-ec758ead391daa2ce0e5697aa0e67ec3ba0f37af.tar.bz2
Initial revision
Diffstat (limited to 'Tools/scripts/suff.py')
-rwxr-xr-xTools/scripts/suff.py29
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()