import sys
import re
if len(sys.argv) > 2:
print "usage: ", sys.argv[0], "type {commandfile}"
sys.exit(1)
type = sys.argv[1]
if len(sys.argv) == 3:
cf = open(sys.argv[2], "r")
if len(sys.argv) == 2:
print ">>>",
line = raw_input()
else:
line = cf.readline()
print ">>> " + line.rstrip()
command = line.split()
feet = r"([+/-]\d\.\d+\s feet)"
f = re.compile(feet)
meters = r"([+/-]\d\.\d+\s metres)"
m = re.compile(meters)
pounds = r"([+/-]\d\.\d+\s pounds)"
p = re.compile(pounds)
kilos = r"([+/-]\d\.\d+\s kilos)"
k = re.compile(kilos)
Im wondering is that right to find the numbers either in a file like
Though Bill weighs 500 pounds and can run 42.3 metres per minute, Sue (who came in at 59 kilos), can outrun him at 910.02 feet per second, and that while hauling 20.5 kilos on a braided hemp rope. Amazing! All that action in 5280 feet!!! Wonder what they could do in 10000 metres? And Sue with 5.7 pounds?
or in just a single line entry like "600 feet", I'm new to the re module and I'm wondering if each unit i got made is proper
Thanks for your help

New Topic/Question
Reply



MultiQuote




|