i want store foto data in file in python. strange characters in file files not open properly. i'm trying remove data array before save in file:
def save_foto(self): """ save foto data file """ self.data_aux = '' last = 0 self.data_list = list(self.vfoto) in range(0,len(self.vfoto)): if(self.vfoto[i]=='\x90' , self.vfoto[i+1]=='\x00' , self.vfoto[i+2]=='\x00' , self.vfoto[i+3]=='\x00' , self.vfoto[i+4]=='\x00' , self.vfoto[i+5]=='\x00' , self.vfoto[i+6]=='\x00' , self.vfoto[i+7]=='\x00' , self.vfoto[i+8]=='\x00' , 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 error
"typeerror: integer required (got type str)" on line aux1=''.join(map(chr,self.data_list[last:i])).
can 1 me , explain me whats goin on? in advance.
i suspect problem comes not using binary mode when reading , writing file. see this question basic read/write binary file in python.
Comments
Post a Comment