Reputation: 207
while 1:
try:
#read from stdin
line = sys.stdin.readline()
except KeyboardInterrupt:
break
if not line:
break
fields = line.split('#')
...
How can I skip first line reading from stdin
?
Upvotes: 9
Views: 10374
Reputation: 304195
infile = sys.stdin
next(infile) # skip first line of input file
for line in infile:
if not line:
break
fields = line.split('#')
...
Upvotes: 9