{ "cells": [ { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "# f-strings\n", "\n", "* https://www.python.org/dev/peps/pep-0498\n", "* https://cito.github.io/blog/f-strings" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "deletable": true, "editable": true }, "outputs": [], "source": [ "import sys" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "You are using Python ['Python 3.6.0'] located at E:\\pyvenv\\3.6\\test2\\Scripts\\python.exe\n" ] } ], "source": [ "pyversion = !python -V\n", "\n", "pyexecutable = sys.executable\n", "\n", "print(f\"\"\"You are using Python {pyversion} located at {pyexecutable}\"\"\")" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Details of person: \n", "\tFirst Name is \"Satish\" \n", "\tLast Name is \"Goda\" \n" ] } ], "source": [ "class Person:\n", " def __init__(self, fname, lname):\n", " self.fname = fname\n", " self.lname = lname\n", "\n", "person1 = Person(\"Satish\", \"Goda\")\n", "\n", "print(f\"\"\"Details of person: \\n\\tFirst Name is \"{person1.fname}\" \\n\\tLast Name is \"{person1.lname}\" \"\"\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.6 Test2", "language": "python", "name": "python36test2" }, "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.6.0" } }, "nbformat": 4, "nbformat_minor": 2 }