##// END OF EJS Templates
Better use Python slicing
Thomas Kluyver -
Show More
@@ -44,19 +44,18 b' class NotebookManager(LoggingConfigurable):'
44
44
45 def named_notebook_path(self, notebook_path):
45 def named_notebook_path(self, notebook_path):
46
46
47 l = len(notebook_path)
48 names = notebook_path.split('/')
47 names = notebook_path.split('/')
49 if len(names) > 1:
48 if len(names) > 1:
50 name = names[len(names)-1]
49 name = names[-1]
51 if name[(len(name)-6):(len(name))] == ".ipynb":
50 if name.endswith(".ipynb"):
52 name = name
51 name = name
53 path = notebook_path[0:l-len(name)-1]+'/'
52 path = notebook_path[0:-len(name)-1]+'/'
54 else:
53 else:
55 name = None
54 name = None
56 path = notebook_path+'/'
55 path = notebook_path+'/'
57 else:
56 else:
58 name = names[0]
57 name = names[0]
59 if name[(len(name)-6):(len(name))] == ".ipynb":
58 if name.endswith(".ipynb"):
60 name = name
59 name = name
61 path = None
60 path = None
62 else:
61 else:
General Comments 0
You need to be logged in to leave comments. Login now