Python - 从输入中读取每2行

时间:2016-02-01 03:07:53

标签: python python-2.7 for-loop input readlines

有没有办法可以有效地从输入中读取每两行?所以,在

data = fileinput.input()  
# Now, instead of doing
for line in data:
    pass
# I need to do
for (every block of two lines in data):
    pass

我正在使用Python 2.

0 个答案:

没有答案