contro opinion wrote: > please download the attachment ,and put in c:\test.data
Your data didn't make it through. > and run the folloeing code: > > from struct import unpack > file_obj = open('c:\\test.data', 'r') Open the file in binary mode to disable CRNL-to-NL translation which will corrupt your binary data. file_obj = open('c:\\test.data', 'rb') > day = file_obj.read(40) > while day: > parsed = list(unpack('LLLLLLL', day[:28])) > print parsed > day = file_obj.read(40) > [20081024, 1875631, 1888101, 1825526, 1839621, 31704770, 51634501] > テi2Iロ > > Traceback (most recent call last): > File "C:\data.py", line 5, in <module> > parsed = list(unpack('LLLLLLL', day[:28])) > error: unpack requires a string argument of length 28 > > > why i can't parse all of them??i just can get a small part of them. I believe a '\x1a' byte marks the end of a text file. Maybe you've run into one of these. -- http://mail.python.org/mailman/listinfo/python-list