svn 提交记录导出csv

思路 log->xml->csv

from bs4 import BeautifulSoup
import csv

# svn log -l 100 --xml > perfweb.xml

with open('D:\\perfweb.xml', encoding='UTF-8') as f_input:
    soup = BeautifulSoup(f_input, "lxml")

with open('perweb.csv', 'w', newline='', encoding='UTF-8') as f_output:
    csv_output = csv.writer(f_output)
    csv_output.writerow(['author', 'date', 'msg'])

    for tns in soup.find_all("logentry"):
        csv_output.writerow(tns.find(entry).text for entry in ['author', 'date', 'msg'])
posted @ 2022-04-29 11:09  懒企鹅  阅读(297)  评论(0编辑  收藏  举报