Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## you need to set your own directory to run this code
- from pathlib import Path
- import re
- a=r'\Users\andre\Documents\experimental\path.ipynb'
- a
- x = re.search(r'[^\\]+(?=\.ipynb$)', 'Users\andre\Documents\experimental\Monte Carlo Integration.ipynb')
- x.group()
- files=[]
- for fromfile in directory.iterdir():
- try:
- print(fromfile)
- x = re.search(r'[^\\]+(?=\.ipynb$)', fromfile)
- print(x.group())
- files.append(x.group())
- except:
- pass
- print(files)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement