Beispiel #1
0
def main():
    text = mogura.get_country_text(u"イギリス", mogura.get_country())
    section_list = [
        line.strip() for line in text.split("\n") if line.startswith("==")
    ]
    print "\n".join([
        section + "\t" + str(section.count("=") / 2 - 1)
        for section in section_list
    ])
Beispiel #2
0
def get_infobox(country):
    text = mogura.get_country_text(country, mogura.get_country())
    infobox = [
        line.strip() for line in text.split("\n}}\n")[0].split("\n")
        if line.startswith("|")
    ]
    return dict([
        tuple(line.split("<ref>")[0].replace("|", "").split(" = "))
        for line in infobox
    ])
Beispiel #3
0
def main():
    text = mogura.get_country_text(u"イギリス", mogura.get_country())
    category_list = [
        line.strip() for line in text.split("\n")
        if line.startswith("[[Category:")
    ]
    print "\n".join([
        line.split("|")[0].replace("[[Category:", "").replace("]]", "")
        for line in category_list
    ])
Beispiel #4
0
def main():
    text = mogura.get_country_text(u"イギリス", mogura.get_country())
    section_list = [line.strip() for line in text.split("\n") if line.startswith("==")]
    print "\n".join([section+"\t"+str(section.count("=")/2-1) for section in section_list])
Beispiel #5
0
def main():
    text = mogura.get_country_text(u"イギリス", mogura.get_country())
    print "\n".join([line.strip() for line in text.split("\n") if line.startswith("[[ファイル:")])
Beispiel #6
0
def get_infobox(country):
    text = mogura.get_country_text(country, mogura.get_country())
    infobox = [line.strip() for line in text.split("\n}}\n")[0].split("\n") if line.startswith("|")]
    return dict([tuple(line.split("<ref>")[0].replace("|", "").split(" = ")) for line in infobox])
Beispiel #7
0
def main():
    text = mogura.get_country_text(u"イギリス", mogura.get_country())
    category_list = [line.strip() for line in text.split("\n") if line.startswith("[[Category:")]
    print "\n".join([line.split("|")[0].replace("[[Category:", "").replace("]]", "") for line in category_list])