Last active
January 30, 2021 04:52
-
-
Save vishalsingha/8fcf2138c685671c93247cb5bf6400a2 to your computer and use it in GitHub Desktop.
Escape Sequences.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Escape Sequences.ipynb", | |
"provenance": [], | |
"authorship_tag": "ABX9TyObD0Dv5L4f2CXJI1LNc/Qi", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/vishalsingha/8fcf2138c685671c93247cb5bf6400a2/escape-sequences.ipynb\" target=\"_blank\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 128 | |
}, | |
"id": "SggSMX21Yqmj", | |
"outputId": "9a7ba135-9c85-4166-f872-91e0b49187bb" | |
}, | |
"source": [ | |
"print('Hi what's app') " | |
], | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "error", | |
"ename": "SyntaxError", | |
"evalue": "ignored", | |
"traceback": [ | |
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-57-204f31eda9b1>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m print('Hi what's app')\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "v3nL8JARY-Sc", | |
"outputId": "dae45f21-7cc3-4aa7-b3fe-460dc3f869d9" | |
}, | |
"source": [ | |
"print('Hi what\\'s app') # \"\\'\" =====> for printing \"'\"\r\n", | |
"print(\"Hello \\\"Akhil\\\" \") # '\"' =====> for printing '\"' \r\n", | |
"print('a\\\\b') # '\\\\' =====> for printing '\\' \r\n", | |
"print(\"hello \\t world\") # '\\t' =====> for printing Tab \r\n", | |
"print(\"hello\\b world\") # '\\b' =====> for printing backspace \r\n", | |
"print(\"hello \\043 world\") # '\\043' ===> for printing its octal value\r\n", | |
"print(\"hello \\x43 world\") # '\\043' ===> for printing its hex value\r\n", | |
"print(\"hello \\rthis is \\rKing\") # print the last slice after \\r. If last slice in empty print the second last slice after \\r.\r\n", | |
"print(\"hello \\rthis is \\r\") " | |
], | |
"execution_count": 2, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Hi what's app\n", | |
"Hello \"Akhil\" \n", | |
"a\\b\n", | |
"hello \t world\n", | |
"hello\b world\n", | |
"hello # world\n", | |
"hello C world\n", | |
"hello \rthis is \rKing\n", | |
"hello \rthis is \r\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "qHcNOJ8Pk7mc" | |
}, | |
"source": [ | |
"" | |
], | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment