[英]How can I skip first line reading from stdin?
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
?如何跳过从
stdin
读取的第一行?
infile = sys.stdin
next(infile) # skip first line of input file
for line in infile:
if not line:
break
fields = line.split('#')
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.