Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateuserid #62

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions Narrative-Reading.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Name,GitHubID
Ache,wodeche
SwiftEvo,Swiftevo
Connie,rich-loam
Oscar,luffythink
Linda,Linda-zx
Kevin,ztm0929
BigFei,hBigFei
bububut,bububut
Lorin,lulleeeeee
realgu,ChengruiGu
Lillian,lilian79511
Paris,paaarissss
Tristan,Tristan3198
Stella,LunaWang5209
chloe,Chloezhu010
FANJIA,Vansir01
KarlLEEN,KarlLeen
haoran,NeoLeeAI
Rae,Raeeeeelei
Lelouch,JL-Lelouch
flytoufu,flytoufu2024
Punkcan,punkcanyang
Marcus,MRzzz-cyber
Ray,rayjun
Jessie,JessieJiang2021
yulai,yulai-123
Mercy,Warmicy
Daniel,Insomnia501
wenQ,wenQian-see
Reign,taoranzhishang
Ailce889,Ailce889
Nour,Nourbit
owen,zhangtaotaoBTC
char,charlottyge
File renamed without changes.
File renamed without changes.
File renamed without changes.
50 changes: 50 additions & 0 deletions ReTool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import pandas as pd
import os

def read_csv_data(file_path):
"""
读取CSV文件并返回包含name和GitHubid的字典列表
"""
try:
df = pd.read_csv(file_path)
return df[['Name', 'GitHubID']].to_dict(orient='records')
except Exception as e:
print(f"Error reading CSV: {e}")
return None

def rename_md_files(csv_data):
"""
根据CSV数据重命名.md文件
"""
if not csv_data:
print("No CSV data available for renaming files.")
return

for item in csv_data:
old_filename = f"{item['Name']}.md"
new_filename = f"{item['GitHubID']}.md"

if os.path.exists(old_filename):
try:
os.rename(old_filename, new_filename)
print(f"Renamed {old_filename} to {new_filename}")
except Exception as e:
print(f"Error renaming {old_filename}: {e}")
else:
print(f"File not found: {old_filename}")

def main():
# CSV文件路径
csv_file_path = 'Narrative-Reading.csv' # 请确保这是正确的CSV文件路径

# 读取CSV文件
csv_data = read_csv_data(csv_file_path)

# 重命名文件
if csv_data:
rename_md_files(csv_data)
else:
print("Failed to read CSV data. File renaming process aborted.")

if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading