Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6d8c090

Browse files
committed
Adding FileLink example in the right new place.
1 parent b62fdec commit 6d8c090

1 file changed

Lines changed: 108 additions & 1 deletion

File tree

examples/notebooks/Part 5 - Rich Display System.ipynb

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,113 @@
290290
],
291291
"prompt_number": 3
292292
},
293+
{
294+
"cell_type": "heading",
295+
"level": 2,
296+
"metadata": {},
297+
"source": [
298+
"Links to local files"
299+
]
300+
},
301+
{
302+
"cell_type": "markdown",
303+
"metadata": {},
304+
"source": [
305+
"If we want to create a link to one of them, we can call use the `FileLink` object."
306+
]
307+
},
308+
{
309+
"cell_type": "code",
310+
"collapsed": false,
311+
"input": [
312+
"from IPython.display import FileLink, FileLinks\n",
313+
"FileLink('Part 1 - Running Code.ipynb')"
314+
],
315+
"language": "python",
316+
"metadata": {},
317+
"outputs": [
318+
{
319+
"html": [
320+
"<a href='files/Part 1 - Running Code.ipynb' target='_blank'>Part 1 - Running Code.ipynb</a><br>"
321+
],
322+
"output_type": "pyout",
323+
"prompt_number": 2,
324+
"text": [
325+
"/home/bgranger/Documents/ipython/examples/notebooks/Part 1 - Running Code.ipynb"
326+
]
327+
}
328+
],
329+
"prompt_number": 2
330+
},
331+
{
332+
"cell_type": "markdown",
333+
"metadata": {},
334+
"source": [
335+
"Alternatively, if we want to link to all of the files in a directory, we can use the `FileLinks` object, passing `'.'` to indicate that we want links generated for the current working directory. Note that if there were other directories under the current directory, `FileLinks` would work in a recursive manner creating links to files in all sub-directories as well."
336+
]
337+
},
338+
{
339+
"cell_type": "code",
340+
"collapsed": false,
341+
"input": [
342+
"FileLinks('.')"
343+
],
344+
"language": "python",
345+
"metadata": {},
346+
"outputs": [
347+
{
348+
"html": [
349+
"./<br>\n",
350+
"&nbsp;&nbsp;<a href='files/./Animations Using clear_output.ipynb' target='_blank'>Animations Using clear_output.ipynb</a><br>\n",
351+
"&nbsp;&nbsp;<a href='files/./Custom Display Logic.ipynb' target='_blank'>Custom Display Logic.ipynb</a><br>\n",
352+
"&nbsp;&nbsp;<a href='files/./SymPy Examples.ipynb' target='_blank'>SymPy Examples.ipynb</a><br>\n",
353+
"&nbsp;&nbsp;<a href='files/./Part 2 - Basic Output.ipynb' target='_blank'>Part 2 - Basic Output.ipynb</a><br>\n",
354+
"&nbsp;&nbsp;<a href='files/./Frontend-Kernel Model.ipynb' target='_blank'>Frontend-Kernel Model.ipynb</a><br>\n",
355+
"&nbsp;&nbsp;<a href='files/./Part 5 - Rich Display System.ipynb' target='_blank'>Part 5 - Rich Display System.ipynb</a><br>\n",
356+
"&nbsp;&nbsp;<a href='files/./animation.m4v' target='_blank'>animation.m4v</a><br>\n",
357+
"&nbsp;&nbsp;<a href='files/./Trapezoid Rule.ipynb' target='_blank'>Trapezoid Rule.ipynb</a><br>\n",
358+
"&nbsp;&nbsp;<a href='files/./Part 4 - Markdown Cells.ipynb' target='_blank'>Part 4 - Markdown Cells.ipynb</a><br>\n",
359+
"&nbsp;&nbsp;<a href='files/./R Magics.ipynb' target='_blank'>R Magics.ipynb</a><br>\n",
360+
"&nbsp;&nbsp;<a href='files/./Part 1 - Running Code.ipynb' target='_blank'>Part 1 - Running Code.ipynb</a><br>\n",
361+
"&nbsp;&nbsp;<a href='files/./Typesetting Math Using MathJax.ipynb' target='_blank'>Typesetting Math Using MathJax.ipynb</a><br>\n",
362+
"&nbsp;&nbsp;<a href='files/./Part 3 - Pylab and Matplotlib.ipynb' target='_blank'>Part 3 - Pylab and Matplotlib.ipynb</a><br>\n",
363+
"&nbsp;&nbsp;<a href='files/./Script Magics.ipynb' target='_blank'>Script Magics.ipynb</a><br>\n",
364+
"&nbsp;&nbsp;<a href='files/./Octave Magic.ipynb' target='_blank'>Octave Magic.ipynb</a><br>\n",
365+
"&nbsp;&nbsp;<a href='files/./Cell Magics.ipynb' target='_blank'>Cell Magics.ipynb</a><br>\n",
366+
"&nbsp;&nbsp;<a href='files/./python-logo.svg' target='_blank'>python-logo.svg</a><br>\n",
367+
"&nbsp;&nbsp;<a href='files/./Data Publication API.ipynb' target='_blank'>Data Publication API.ipynb</a><br>\n",
368+
"&nbsp;&nbsp;<a href='files/./Progress Bars.ipynb' target='_blank'>Progress Bars.ipynb</a><br>\n",
369+
"&nbsp;&nbsp;<a href='files/./Cython Magics.ipynb' target='_blank'>Cython Magics.ipynb</a><br>"
370+
],
371+
"output_type": "pyout",
372+
"prompt_number": 3,
373+
"text": [
374+
"./\n",
375+
" Animations Using clear_output.ipynb\n",
376+
" Custom Display Logic.ipynb\n",
377+
" SymPy Examples.ipynb\n",
378+
" Part 2 - Basic Output.ipynb\n",
379+
" Frontend-Kernel Model.ipynb\n",
380+
" Part 5 - Rich Display System.ipynb\n",
381+
" animation.m4v\n",
382+
" Trapezoid Rule.ipynb\n",
383+
" Part 4 - Markdown Cells.ipynb\n",
384+
" R Magics.ipynb\n",
385+
" Part 1 - Running Code.ipynb\n",
386+
" Typesetting Math Using MathJax.ipynb\n",
387+
" Part 3 - Pylab and Matplotlib.ipynb\n",
388+
" Script Magics.ipynb\n",
389+
" Octave Magic.ipynb\n",
390+
" Cell Magics.ipynb\n",
391+
" python-logo.svg\n",
392+
" Data Publication API.ipynb\n",
393+
" Progress Bars.ipynb\n",
394+
" Cython Magics.ipynb"
395+
]
396+
}
397+
],
398+
"prompt_number": 3
399+
},
293400
{
294401
"cell_type": "heading",
295402
"level": 3,
@@ -1127,4 +1234,4 @@
11271234
"metadata": {}
11281235
}
11291236
]
1130-
}
1237+
}

0 commit comments

Comments
 (0)