struct.unpack

g.franzkowiak g.franzkowiak at onlinehome.de
Mon Oct 3 06:14:38 EDT 2005


Peter Otten schrieb:
> g.franzkowiak wrote:
> 
> 
>>tmpList = list(dataObject)[:4])
>>obj     = tmpList[0]+tmpList[1]+tmpList[2]+tmpList[3].
> 
> 
> Have you tried just
> 
> obj = dataObject[:4]
> 
> without the intermediate list? If that failed, can you tell us the type of
> the dataObject? E. g.
> 
> 
>>>>print type(dataObject)
> 
> <class '__main__.NeitherListNorString'>
> 
> Peter
> 

The dataObject was read from a named pipe as an byte stream

state, dataObject = win32file.ReadFile(handle, nbytes, None)
print repr(dataObject)
 ==> '\x01\x02\x03\x04\x00\x00\x00\x00\x00\x00\x0.....

With Frederiks help operates this fine

gerd



More information about the Python-list mailing list