Erklärt, wie der Name einer Datei, die ein bestimmtes Wort (z. B. .htm) enthält, aus einer Datei in einem Ordner abgerufen wird.
Code zum Extrahieren von Dateien in dem im Dateipfad angegebenen Verzeichnis, das ".htm" im Dateinamen enthält.
test.py
import glob
filepath = 'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc/'
files = glob.glob(filepath+'*.htm') #Holen Sie sich die HTML-Datei
files = sorted(files) #Einfach die Dateien sortieren
print(files)
★★ Ausführungsergebnis ★★
python
['C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0000000_header_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0101010_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0102010_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0103010_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm', 'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0104010_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105000_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105010_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105020_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105025_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105040_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm', 'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105050_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105100_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105110_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm', 'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105310_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105320_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105330_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm', 'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105400_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0105410_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0106010_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm', 'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0107010_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm',
'C:/Users/fdfpy/work/yuho/stuck/XBRL/PublicDoc\\0201010_honbun_jpcrp030000-asr-001_E02995-000_2019-08-20_01_2019-11-08_ixbrl.htm']