You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import os
from pathlib import Path
def get_latest_notebook():
"""
Returns the path to the most recently modified .ipynb file in the current directory.
Returns None if no .ipynb files are found.
"""
# Get all ipynb files in current directory
notebook_files = list(Path('.').glob('*.ipynb'))
if not notebook_files:
return None
# Get the most recent file based on modification time
latest_notebook = max(notebook_files, key=lambda x: x.stat().st_mtime)
return latest_notebook
# Example usage:
# latest_nb = get_latest_notebook()
# if latest_nb:
# print(f"Most recent notebook: {latest_nb}")
# else:
# print("No notebook files found")
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: