googlebooks:如何从从我的图书馆导出的XML文件中导入图书列表?

2024-09-29 22:22:00 发布

您现在位置:Python中文网/ 问答频道 /正文

根据My Library常见问题解答,我可以export my bookshelf as XML按照以下说明操作:

When viewing any bookshelves within 'My library' on Google Books, simply select Export as XML to download that bookshelf file.

但是,当我想import a list of books时,我必须按照以下说明使用ISBN编号列表:

When viewing any bookshelves within 'My library' on Google Books, click Options, then select Add by ISBN or ISSN. Enter one ISBN or ISSN per line, and click the Add books button when you are done.

我如何使用从我的图书馆导出的XML文件来导入我的书(可能是因为我要换个帐户,想转移我的图书馆)?在


Tags: onmyasgooglelibraryanyxmlbooks
1条回答
网友
1楼 · 发布于 2024-09-29 22:22:00

如果安装了Python,可以运行这个脚本,它将打印出当前目录中每个XML文件中找到的每个ISBN编号。在

import glob
for xml in glob.glob('*.xml'):
    with open(xml) as f:
        for line in f:
            line = line.strip()
            if line.startswith('<value>'):
                # ISBN number is between the <value>...</value> tags.
                print line[7:-8]

相关问题 更多 >

    热门问题