blob: 2f6ef686890df92ceab37ad6982419ed4ad84c8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# (c) Copyright 2007 The Board of Trustees of the University of Illinois.
from binaryfilecompare import eof, many
# Rename the builtin 'float' variable to avoid name conflicts
builtin_float = float
def verbatim(f):
"""Read a line of text from file 'f'."""
line = f.readline()
return line
def float(f):
"""Read a line of text from file 'f' as a single floating-point
number."""
words = f.readline().split()
if len(words) != 1:
raise ValueError, "Expecting line to contain a single number"
return builtin_float(words[0])
def floats(f):
"""Read a line of text from file 'f' as a list of floating-point
numbers."""
words = f.readline().split()
return [builtin_float(x) for x in words]
|