i made a file reader but it always returns corrupted:
def load(charactor):
fout = open(charactor + '.actor', 'r')
fout.seek(0)
actor_type = None
attrs = []
for index, line in enumerate(fout.readlines()):
if index == 0:
actor_type = line.replace('{', "").strip()
if index == 1:
if line == 'attributes':
if not line == '}':
val = line.replace('\"', '').split('=').strip()
attrs.append(val)
elif line == 'extras':
if not line == '}':
val = line.replace('\"', '').split('=').strip()
attrs.append(val)
else:
print 'Corrupt file: ' + charactor + '.actor'
break
return str(actor_type), attrs
fout.close()
var = load('person')
any idea? i want it to succede not be corrupted