I'd like to separate the input by an blank line, repeat reading the input until 2 blank lines are received. Here is the expected input format:
A
B
C
A B 2
A C 3
C B 4
A B 1
I have tried
for line in sys.stdin:
node = [line]
if line == ' ':
cost = [line.split()]
if line == ' ':
distance = [line.split()]
But it can not stop reading input with 2 blank lines. Any advice?