Stuck
Fergus M Hayman
shayman at uniserve.com
Wed May 17 16:14:05 EDT 2000
Hi
Trying to process a file and format it for printing.
As such
import string
f = raw_input('Enter file : ')
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