| 1234567891011121314 |
- import re, os
- wiki_dir = "C:\\Coding\\python\\dropbox-pictures-regex\\wiki\\"
- # koment
- regex = r"(?:(?:https?)+\:\/\/+[a-zA-Z0-9\/\._-]{1,})+(?:(?:jpe?g|png))"
- for path, dirs, files in os.walk(wiki_dir):
- for file in files:
- if file.endswith('.md'):
- file_path = os.path.join(path, file)
- with open(file_path, 'r', encoding='utf8') as f:
- text = f.read()
- matches = re.findall(regex, text)
- print(f"Soubor: {file_path}\nobrazek: {matches}")
|