[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fileinput module not yielding expected results

> On 7 Sep 2019, at 16:33, Dan Sommers <2QdxY4RzWzUUiLuE at> wrote:
>    with fileinput ...:
>        for line in f:
>            if fileinput.isfirstline():
>                headers = extract_headers(line)
>            else:
>                pass # process a non-header line here

If you always know you can skip the first line I use this pattern

with fileinput ...:
    next(f) # skip header
    for line in f:
	# process a non-header line here