The 0.5 release happened on 2/15, not on 2/14. :-)
[python/dscho.git] / Lib / lib-old / util.py
blob6cb143342639d0c166cba45e5b36d7b2ffd91134
1 # Module 'util' -- some useful functions that don't fit elsewhere
3 # NB: These are now built-in functions, but this module is provided
4 # for compatibility. Don't use in new programs unless you need backward
5 # compatibility (i.e. need to run with old interpreters).
8 # Remove an item from a list.
9 # No complaints if it isn't in the list at all.
10 # If it occurs more than once, remove the first occurrence.
12 def remove(item, list):
13 if item in list: list.remove(item)
16 # Return a string containing a file's contents.
18 def readfile(fn):
19 return readopenfile(open(fn, 'r'))
22 # Read an open file until EOF.
24 def readopenfile(fp):
25 return fp.read()