Created
November 14, 2021 04:19
-
-
Save hxy9243/762c155b7dc1b4dbd8521084d77dc659 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# required libraries: | |
# pandas, openpyxl | |
import pandas as pd | |
def read_excel(): | |
with open('高等学校-法宝列表.xlsx', 'rb') as f: | |
data = pd.read_excel(f, engine='openpyxl', header=0, | |
sheet_name='for dissertation') | |
with open('output.citespace', 'w') as outf: | |
for _, row in data.iterrows(): | |
release_date = row['发布日期'] | |
title = row['标题'] | |
author = row['发布部门/主办单位'] | |
outf.write( | |
f'RT Journal\n' | |
f'T1 Journal\n' | |
f'JO GWYB\n' | |
f'SN 0000-0000\n' | |
f'CN 00-0000/D\n' | |
f'T1 {title}\n' | |
f'YR {release_date}\n' | |
) | |
if not pd.isna(author): | |
outf.write(f'AI {author}\n') | |
outf.write('\n') | |
if __name__ == '__main__': | |
read_excel() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment