I would like to read some formatted data in python. The format of the data is something similar to this:

```
00:00:00
1 1 1
1 1 1
1 1 1

00:00:02
3 3 3
3 3 3
3 3 3

```

I could successfully simulate the reading in C/C++ using the forward code:

```
int main()
{
    string hour;
    int x0,y0,z0, x1,y1,z1, x2,y2,z2;

    while(cin >> hour)
    {
        scanf("%d %d %d\n%d %d %d\n%d %d %d\n", &x0, &y0, &z0, &x1, &y1, &z1, &x2, &y2, &z2);
        cout << hour << endl; //check the reading
    }
    return 0;
}

```

The problem is that i cannot find some Python's method that read a formatted multi-line string as simple as the scanf can. Some examples from np.genfromtxt got near to what a needed, as some from struct.unpack, but my skills wasn't enough to make it works right with the multi-lines.
I could probably use split() with some readline to get exactly the formatted data, but it driving me nuts that a program in C/C++ would be simpler than on in Python. Is there any way to do something similar to the C/C++ code in Python?

---

Here is the answer after the Joril's help:

```
from scanf import sscanf
import sys

data = ''
for line in sys.stdin:
    if line != '\n':
        data += line
    else:
        print sscanf(data, "%s\n%d %d %d\n%d %d %d\n%d %d %d\n")
        data = ''

```

And as output i got something like: 

```
('00:00:00', 1, 1, 1, 1, 1, 1, 1, 1, 1)
('00:00:02', 3, 3, 3, 3, 3, 3, 3, 3, 3)

```