Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make download link in Jupyter appmode

from ipywidgets import HTML
from IPython.display import display

import base64

res = 'computed results'

#FILE
filename = 'res.txt'
b64 = base64.b64encode(res.encode())
payload = b64.decode()

#BUTTONS
html_buttons = '''<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<a download="{filename}" href="data:text/csv;base64,{payload}" download>
<button class="p-Widget jupyter-widgets jupyter-button widget-button mod-warning">Download File</button>
</a>
</body>
</html>
'''

html_button = html_buttons.format(payload=payload,filename=filename)
display(HTML(html_button))
Comment

PREVIOUS NEXT
Code Example
Python :: phone no validate 
Python :: fibonacci numbers in lamda python 
Python :: python tuple multiply sequence 
Python :: where are dictd dictionaries 
Python :: tuple merging 
Python :: python image processing and resizing 
Python :: how to insert value in admin panel in django 
Python :: dynamo python templete path 
Python :: ptyhton json respones 
Python :: python colorama 
Python :: code help 
Python :: pandas data frame from part of excel openpyxl 
Python :: python time-stamp conversion 
Python :: @action(detail=true) meaning 
Python :: numpy generlized ufunc 
Python :: how to run django server outside world 
Python :: pandas increment value on condition 
Python :: sum of the first nth term of series codewars python 
Python :: 1046 uri solution 
Python :: python identation 
Python :: trigger to print on python 
Python :: meaning of self keyword in user defined function 
Python :: json file download 
Python :: nim game in python 
Python :: bbc weather webscraping python beautifulsoup 
Python :: program to print areas in python 
Python :: python show difference between two strings and colorize it 
Python :: Get First In Table Django 
Python :: slice all elements from list 
Python :: benifits fo nested classes in python 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =