nicuf

poy

Jun 3rd, 2021 (edited)
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import os
  2. path = "D:/11"
  3.  
  4. def listdir(dir):
  5.     filenames = os.listdir(dir)
  6.     for files in filenames:
  7.         print(files)
  8.  
  9. listdir(path)
  10.  
  11.  
  12. extensie_fisier = ".html"
  13.  
  14. regexes = {
  15.     r'<title>.*\|\K(.*)(</title>)': r'Bebe',  #  First regex           r'regex1': r'string1'
  16.     r'^<html.*$': r'yes'                      #  Second regex          r'regex1': r'string1'
  17. }
  18.  
  19. for k, v in regexes.items():
  20.     print(re.sub(k, v, 'text'))
  21.  
  22.  
  23. with open("*.html", mode="w") as file:  # See note 2.
  24.     contents = file.write(f"{extensie_fisier.text}")
  25.  
  26. print("DONE !")
  27.  
Add Comment
Please, Sign In to add comment