Kaydet (Commit) 45ac47c0 authored tarafından Guido van Rossum's avatar Guido van Rossum

Allow open file as parameter (must be seekable) (Jack)

üst 84503701
......@@ -2,13 +2,19 @@
#-------------------------#
# Recognize sound headers #
# Recognize image headers #
#-------------------------#
def what(filename, h=None):
def what(file, h=None):
if h is None:
f = open(filename, 'r')
if type(file) == type(''):
f = open(file, 'rb')
h = f.read(32)
else:
location = file.tell()
h = file.read(32)
file.seek(location)
f = None
else:
f = None
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment