In article <[EMAIL PROTECTED]>, Tim Chase <[EMAIL PROTECTED]> wrote: >> I hope this is the right place to ask, but I am trying to come up with >> a way to parse each line of a file. Unfortunately, the file is neither >> comma, nor tab, nor space delimited. Rather, the character locations >> imply what field it is. >> >> For example: >> >> The first ten characters would be the record number, the next >> character is the client type, the next ten characters are a volume, >> and the next three are order type, and the last character would be an >> optional type depending on the order type. > >Sounds like you could do something like > > recno_idx = slice(0,10) > client_idx = slice(10, 11) > volume_idx = slice(11,11+10) > order_type_idx = slice(11+10, 11+10+3) . . . !? That seems to me confusingly far from a working solution, at least in comparison to
recno_idex = the_line[0:10] client_idx = the_line[10:11] ... What am I missing? -- http://mail.python.org/mailman/listinfo/python-list