筆記:TPLinker Single-stage Joint Extraction of Entities and Relations Through Token Pair Linking
阿新 • • 發佈:2022-05-05
# 修改工作目錄 import os os.chdir(r'C:\Users\Hider\Desktop') # 定義函式 def list_all_files(rootdir): import os _files = [] # 列出資料夾下所有的目錄與檔案 list = os.listdir(rootdir) for i in range(0, len(list)): # 構造路徑 path = os.path.join(rootdir, list[i]) # 判斷路徑是否為檔案目錄或者檔案 # 如果是目錄則繼續遞迴if os.path.isdir(path): _files.extend(list_all_files(path)) if os.path.isfile(path): _files.append(path) return _files # 執行 dir = r'C:\Users\Hider\Desktop\python' # 目錄地址 list_all_files(dir) # 結果 ``` ['C:\\Users\\Hider\\Desktop\\python\\dataminingguide.pdf', 'C:\\Users\\Hider\\Desktop\\python\\kaggle-titanic-learning.py', 'C:\\Users\\Hider\\Desktop\\python\\nba.txt', 'C:\\Users\\Hider\\Desktop\\python\\python-pandas-learning.py', 'C:\\Users\\Hider\\Desktop\\python\\python_algorithm_learning.py', 'C:\\Users\\Hider\\Desktop\\python\\Python程式設計:從入門到實踐.pdf', 'C:\\Users\\Hider\\Desktop\\python\\《Python資料探勘入門與實踐》.pdf', 'C:\\Users\\Hider\\Desktop\\python\\大數定理.py', 'C:\\Users\\Hider\\Desktop\\python\\技術學習.sql', 'C:\\Users\\Hider\\Desktop\\python\\泰坦尼克\\gender_submission.csv', 'C:\\Users\\Hider\\Desktop\\python\\泰坦尼克\\test.csv', 'C:\\Users\\Hider\\Desktop\\python\\泰坦尼克\\titanic.zip', 'C:\\Users\\Hider\\Desktop\\python\\鮑魚\\abalone.csv', 'C:\\Users\\Hider\\Desktop\\python\\鮑魚\\abalone.data', 'C:\\Users\\Hider\\Desktop\\python\\鮑魚\\abalone.names', 'C:\\Users\\Hider\\Desktop\\python\\鮑魚\\abalone.txt', 'C:\\Users\\Hider\\Desktop\\python\\鮑魚\\dim_sex.xlsx', 'C:\\Users\\Hider\\Desktop\\python\\鮑魚\\鮑魚資料集.md'] ```