- First skeleton for tuple printer.

This commit is contained in:
ccremers 2004-10-14 18:18:01 +00:00
parent d33ec486ce
commit dfe16fa306
2 changed files with 48 additions and 1 deletions

View File

@ -6,4 +6,4 @@
# limit number of runs to 5
ulimit -v 100000
cat $* | ../src/scyther -a -r3 --summary
cat $* | ../src/scyther -a -r3 -l20 --summary

47
spdl/tuples.py Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/python
#
# Given a number of input lines on std and an argument int, this program
# generates unordered tuples, e.g.:
#
# arg: 2
# in: a
# b
# c
# d
#
# out: a,b
# a,c
# a,d
# b,c
# b,d
# c,d
#
# This should make it clear what happens.
#
import sys
import string
# Retrieve the tuple width
tuplesize = sys.argv[1]
print tuplesize
# Read stdin into list and count
list = []
loop = 1
while loop:
line = sys.stdin.readline()
if line != '':
# not the end of the input
line = string.strip(line)
if line != '':
# not a blank line
list.append(line)
else:
# end of the input
loop = 0
print list
print len(list)