Refive

Take scattershot wikimedia table data and line it up nicely, five columns per row, with Python

#!/usr/bin/env python3
import sys
count = 0
for line in sys.stdin:
    line = line.rstrip()
    if line == "|-":
        continue
    if line.startswith("|[["):
        print(line)
        count += 1
        if count % 5 == 0:
            print("|-")
    else:
        if line.startswith("{|"):
            count = 0
        print(line)

Unknown's avatar

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment