Skip to content

Instantly share code, notes, and snippets.

@prhbrt
Created February 23, 2017 13:38
Show Gist options
  • Save prhbrt/66ccb71c9d83fea464931ff5bc9375ab to your computer and use it in GitHub Desktop.
Save prhbrt/66ccb71c9d83fea464931ff5bc9375ab to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Done ...\b\b\b\b\b\b\b\b"
]
}
],
"source": [
"import time\n",
"import sys\n",
"\n",
"message = 'Busy ...'\n",
"sys.stdout.write(message)\n",
"sys.stdout.flush()\n",
"time.sleep(1)\n",
"\n",
"sys.stdout.write('\\b' * len(message))\n",
"sys.stdout.write('\\r')\n",
"sys.stdout.flush()\n",
"\n",
"sys.stdout.write('Done')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment