corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | #!/usr/local/bin/python |
2 | |||
3 | import string, sys |
||
4 | |||
5 | # If no arguments were given, print a helpful message |
||
6 | if len(sys.argv)==1: |
||
7 | print '''Usage: |
||
8 | celsius temp1 temp2 ...''' |
||
9 | sys.exit(0) |
||
10 | |||
11 | # Loop over the arguments |
||
12 | for i in sys.argv[1:]: |
||
13 | try: |
||
14 | fahrenheit=float(string.atoi(i)) |
||
15 | except string.atoi_error: |
||
16 | print repr(i), "not a numeric value" |
||
17 | else: |
||
18 | celsius=(fahrenheit-32)*5.0/9.0 |
||
19 | print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5)) |