Stuck

Fergus M Hayman shayman at uniserve.com
Thu May 18 02:06:53 CEST 2000


Fergus M Hayman wrote:                 Thanks         I can move on  again
Thanks

>
>
>
>
> import string
> f = raw_input('Enter file  : ')

    f = open(f)           # oops forgot that line in post
    line = f.readline(f)

> while line:
>     for i  in line:
>         line = f.readline()
>             if line == "H3':
>                     print " Region", '\t:',  [0:]      #       Extract
> first item in  line H3         ??
>                      print " District", "\t", [1:]
>
>         My infile looks like this  from a handheld device
>
> H1: 9085, FERGUS, HAYMAN
> H2: 71G, NORTHVIEW DLS
> H3: VANCOUVER, CHILLIWACK
> H4: 00100s, 100, SB$. 01
> TILL
> H7: 22000
>
>  I      Need formatted output  something like
>
> Region        :
> VANCOUVER
> PAGE 1 OF     1
> DISTRICT:
> CHILLIWACK
> DATE OF SCALE
> Scaled by   : FERGUS HAYMAN
>
> SITE            SCALER        RETURN
>   71G                  9085                 100
>
> :?         Does the  f.readline() function automatically put   the input
> file into a list ie []
> or a string?          I  though a list would be right for text
> formatting.      and file maniputaltion.
>
> (  I can't figure out how to access say   item 71G in  H2:   and assign
> it a place on a print statement)
>
> This is the header first 7 lines i need to be able to slice and dice the
> log data that follows for species,
> volume etc.




More information about the Python-list mailing list