Skip to content

Commit

Permalink
updateuserid
Browse files Browse the repository at this point in the history
  • Loading branch information
DerickIT committed Dec 8, 2024
1 parent 2da987f commit 7cfb799
Show file tree
Hide file tree
Showing 32 changed files with 85 additions and 0 deletions.
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.

0 comments on commit 7cfb799

Please sign in to comment.