I want to store foto data in file in python. But I get some strange characters in my file so this files does not open properly. What I'm trying to do is remove this data from my array before save it in a file:
def save_foto(self):
""" Save foto data to a file """
self.data_aux = ''
last = 0
self.data_list = list(self.vFOTO)
for i in range(0,len(self.vFOTO)):
if(self.vFOTO[i]=='\x90' and self.vFOTO[i+1]=='\x00' and self.vFOTO[i+2]=='\x00' and self.vFOTO[i+3]=='\x00'
and self.vFOTO[i+4]=='\x00' and self.vFOTO[i+5]=='\x00' and self.vFOTO[i+6]=='\x00' and self.vFOTO[i+7]=='\x00'
and self.vFOTO[i+8]=='\x00' and self.vFOTO[i+9]=='\x00'):
aux1=''.join(map(chr,self.data_list[last:i]))
self.data_aux = self.data_aux+aux1
i=i+10
last=i
but I get the error
"TypeError: an integer is required (got type str)" on line aux1=''.join(map(chr,self.data_list[last:i])).
Can some one help me and explain me whats goin on? Thanks in advance.