{"id":3851,"date":"2019-09-29T18:39:00","date_gmt":"2019-09-29T16:39:00","guid":{"rendered":"https:\/\/pythonprogramming.altervista.org\/?p=3851"},"modified":"2019-09-29T21:32:21","modified_gmt":"2019-09-29T19:32:21","slug":"highlight-code-in-html-page-using-a-python-script","status":"publish","type":"post","link":"https:\/\/pythonprogramming.altervista.org\/highlight-code-in-html-page-using-a-python-script\/","title":{"rendered":"Highlight code in html page using a Python script"},"content":{"rendered":"<p>This time I had the need to <strong>highlight<\/strong> some <strong>code<\/strong> into an <strong>html page<\/strong> and I could not use a plugin like we can do in WordPress. In this page, in fact, I use the plugin <strong>Crayon<\/strong>. In another web space (pil.glitch.me) I could not use a plugin like this, so I needed a script to make the job (I do not want to write the html code directly, it woul be a nightmare to do it manually).<\/p>\n<h2>Keywords<\/h2>\n<p>In the kw list you got the <strong>keywords<\/strong> that will be highlighted in orange:<\/p>\n<pre class=\"lang:default decode:true \">kw = [ \"import\", \"from\", \"while\", \"with\", \"for\", \"def\", \"return\"]<\/pre>\n<h2>Highlight functions<\/h2>\n<p>To highlight the functions I have looked for words that have the ( at the end with the findall function of the <strong>module re<\/strong> to use regex in Python.<\/p>\n<pre class=\"lang:default decode:true \">\t_def= re.findall(\"\\w+\\(\", code)\r\n\tfor w in _def:\r\n\t\tcode = code.replace(w, \"&lt;b style='color:blue'&gt;\" + w[:-1] + \"&lt;\/b&gt;(\")\r\n\treturn code<\/pre>\n<p>This is the whole code.<\/p>\n<pre class=\"lang:default decode:true\">import re\r\nimport os\r\n\r\ndef highlight(code):\r\n\t\"pass a string and it will be highlighted\"\r\n\t\r\n\t# keywords to be colored in orange\r\n\tkw = [\t\"import\",\r\n\t\t\t\"from\",\r\n\t\t\t\"while\",\r\n\t\t\t\"with\",\r\n\t\t\t\"for\",\r\n\t\t\t\"def\",\r\n\t\t\t\"return\"]\r\n\tfor k in kw:\r\n\t\tcode = code.replace(k, \"&lt;b style='color:orange'&gt;\" + k + \"&lt;\/b&gt;\")\r\n\tcode = code.replace(\"\\n\",\"&lt;br&gt;\")\r\n\t#print(code)\r\n\r\n\t# The 'indentation'\r\n\tcode = code.replace(\"\\t\", \"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;\")\r\n\r\n\t# functions to be clored in blue\r\n\t_def= re.findall(\"\\w+\\(\", code)\r\n\tfor w in _def:\r\n\t\tcode = code.replace(w, \"&lt;b style='color:blue'&gt;\" + w[:-1] + \"&lt;\/b&gt;(\")\r\n\treturn code\r\n\r\n\r\nhtml = highlight(\"\"\"\r\ndef foo(arg):\r\n\tprint(\"This is fun)\r\n\t\"\"\")\r\n\r\nprint(html)\r\n\r\nwith open(\"code.html\", \"w\") as file:\r\n\tfile.write(html)\r\n\r\nos.startfile(\"code.html\")<\/pre>\n<p>You add your <strong>code<\/strong> into this <strong>function<\/strong> arg when you call it in plain text like in the example below:<\/p>\n<pre class=\"lang:default decode:true \">html = highlight(\"\"\"\r\ndef foo(arg):\r\n\tprint(\"This is fun)\r\n\t\"\"\")<\/pre>\n<p>This is the output:<\/p>\n<pre class=\"lang:default decode:true \">&lt;br&gt;&lt;b style='color:orange'&gt;def&lt;\/b&gt; &lt;b style='color:blue'&gt;foo&lt;\/b&gt;(arg):&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b style='color:blue'&gt;print&lt;\/b&gt;(\"This is fun)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;<\/pre>\n<p>Here is the ouput rendered (this is actually rendered in this page with the code above.:<\/p>\n<p><b style=\"color: orange;\">def<\/b> <b style=\"color: blue;\">foo<\/b>(arg):<br \/>\n<b style=\"color: blue;\">print<\/b>(&#8220;This is fun)<\/p>\n<h2>A little video explanation<\/h2>\n<div style=\"width: 747px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3851-1\" width=\"747\" height=\"420\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output9.mp4?_=1\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output9.mp4\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output9.mp4<\/a><\/video><\/div>\n<h2>A little variant<\/h2>\n<p>In this code we used the module keyword to get all the keywords in Python. Using keyword.kwlist we get a list of all of them. So, here&#8217;s the code, followed by a speed live coding about it:<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true \">import re\r\nimport os\r\nimport keyword\r\n\r\ndef highlight(code):\r\n\t\r\n\tfor k in keyword.kwlist:\r\n\t\tk = k + \" \"\r\n\t\tcode = code.replace(k,\"&lt;b style='color:darkred'&gt;\" + k + \"&lt;\/b&gt;\")\r\n\tcode = code.replace(\"\\n\", \"&lt;br&gt;\")\r\n\tcode = code.replace(\"\\t\", \"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;\")\r\n\tfunctions = re.findall(\"\\w*\\(\", code)\r\n\tfor function in functions:\r\n\t\tcode = code.replace(function[:-1],\"&lt;b style='color:blue'&gt;\" + function[:-1] + \"&lt;\/b&gt;\")\r\n\treturn code\r\n\r\n\r\n\r\nhtml = highlight(\"\"\"\r\ndef foo():\r\n\tprint(\"Hello World\")\r\n\treturn 0\r\n\"\"\")\r\n\r\nprint(html)\r\n\r\nwith open(\"file.html\", \"w\") as file:\r\n\tfile.write(html)\r\n\r\nos.startfile(\"file.html\")\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><iframe loading=\"lazy\" title=\"Highlight code in html page with Python (speed coding)\" width=\"747\" height=\"420\" src=\"https:\/\/www.youtube.com\/embed\/8mvMt89RunY?feature=oembed&amp;enablejsapi=1\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h2>Adding a GUI to the script<\/h2>\n<p>Why not making it <strong>easier<\/strong> for the user to get the html tags to higlight the python code into a web page? Here is the script to create a <strong>GUI<\/strong> with <strong>tkinter<\/strong> module, in which you write the <strong>python<\/strong> code (or paste it) into a <strong>text box<\/strong> and, clicking on a <strong>button<\/strong>, you got it converted in <strong>highlighted<\/strong> <strong>html<\/strong> in the second <strong>Text<\/strong> <strong>box<\/strong>. Another button allows you to see the output in the <strong>browser<\/strong>. What else could you need?<\/p>\n<pre class=\"lang:default decode:true \">import re\r\nimport os\r\nimport keyword\r\nimport tkinter as tk\r\n\r\n\r\ndef highlight(code):\r\n\t\r\n\tfor k in keyword.kwlist:\r\n\t\tk = k + \" \"\r\n\t\tcode = code.replace(k,\"&lt;b style='color:darkred'&gt;\" + k + \"&lt;\/b&gt;\")\r\n\tcode = code.replace(\"\\n\", \"&lt;br&gt;\")\r\n\tcode = code.replace(\"\\t\", \"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;\")\r\n\tfunctions = re.findall(\"\\w*\\(\", code)\r\n\tfor function in functions:\r\n\t\tcode = code.replace(function[:-1],\"&lt;b style='color:blue'&gt;\" + function[:-1] + \"&lt;\/b&gt;\")\r\n\treturn code\r\n\r\n\r\ndef see_the_code(html):\r\n\tprint(html)\r\n\twith open(\"file.html\", \"w\") as file:\r\n\t\tfile.write(html)\r\n\tos.startfile(\"file.html\")\r\n\r\ndef buthigh():\r\n\ttextcodehtml.insert(\"1.0\", highlight(textcode.get(\"1.0\", tk.END)))\r\n\r\ndef show():\r\n\tsee_the_code(highlight(textcode.get(\"1.0\", tk.END)))\r\n\r\nroot = tk.Tk()\r\nlabel = tk.Label(root, text=\"Write the code here:\")\r\nlabel.pack()\r\ntextcode = tk.Text(root, height=5)\r\ntextcode.pack()\r\nbutton = tk.Button(root,text=\"Convert into highleted html\", command=buthigh)\r\nbutton.pack()\r\ntextcodehtml = tk.Text(root, height=5)\r\ntextcodehtml.pack()\r\nbutton = tk.Button(root,text=\"Show the result in the browser\", command=show)\r\nbutton.pack()\r\nroot.mainloop()<\/pre>\n<p>The <strong>Graphic User Interface<\/strong> is this:<\/p>\n<figure id=\"attachment_3861\" aria-describedby=\"caption-attachment-3861\" style=\"width: 646px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/code_high_gui.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3861\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/code_high_gui.png\" alt=\"\" width=\"646\" height=\"273\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/code_high_gui.png 646w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/code_high_gui-320x135.png 320w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/a><figcaption id=\"caption-attachment-3861\" class=\"wp-caption-text\">highlight python code in html<\/figcaption><\/figure>\n<h4>Utilities<\/h4>\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/mind-map-with-python\/\">\r\n<img decoding=\"async\" src=\"https:\/\/i1.wp.com\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/12\/PYDOT.png?resize=321%2C229&ssl=1\"><\/a>\r\n<script>\r\nvar title = \"Utility\";\r\nvar links = [Mak\r\n\t\t\t e\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/create-exe-from-python-script-with-images-with-pyinstaller\/\",\"Make Exe cointaining Images\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/send-email-to-different-people-with-python\/\",\"Send More Email at the same time\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/convert-some-data-into-another-format\/\",\"Convert data separation type into another\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/use-sublime-integrated-with-github\/\",\"Github + Sublime text 3\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/make-html-tables-with-pandas\/\",\"Excel to Html Table with Pandas\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/create-a-beautiful-html-table-with-python\/\",\"Beautiful Html Table made with Python\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/split-images-with-pil-aka-pillow-and-python-for-sprite-animation\/\",\"Crop images\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/sublime-text-snippets-how-to-use-them\/\",\"Snippets in Sublime Text\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/create-a-presentation-html-page-with-all-the-images-in-a-folder-in-a-second\/\",\"Create Html page with images using Python in seconds\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/mind-map-with-python\/\",\"Mind Maps & Python (Pydot)\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pixelize-an-image-with-pil-and-python\/\",\"Pixelize images\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-to-make-pdf-fast-and-free-with-text-or-html\/\",\"Create PDF with Tkinter\"],\r\n[\"\",\"Python Lauches a file in Chrome 2\"],\r\n [\"https:\/\/pythonprogramming.altervista.org\/create-an-html-page-and-launch-it-with-cefpython3-in-chrome\/\",\r\n  \"Python launches a local file in Chrome 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-to-powerpoint-2-0\/\",\"Python vs Powerpoint v.2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/what-if-you-got-dns_probe_finished_nxdomain-with-glitch-me-sites\/\",\"Cannot open a site (dns solution)\"],\r\n['https:\/\/pythonprogramming.altervista.org\/convert-text-to-html-docx-and-pdf\/', 'Covert txt to html, docx and pdf'],\r\n['https:\/\/pythonprogramming.altervista.org\/capture-screenshot-with-python-and-lackey\/', 'Capture screenshot'],\r\n['https:\/\/pythonprogramming.altervista.org\/check-if-a-directory-exists-with-python\/', 'Check if a directory exists'],\r\n['https:\/\/pythonprogramming.altervista.org\/how-to-copy-all-the-files-in-a-directory\/', 'Copy all files in a folder'],\r\n['https:\/\/pythonprogramming.altervista.org\/put-some-order-in-my-files-with-python-with-filecollector\/', 'Copy many file on pc in one folder'],\r\n['https:\/\/pythonprogramming.altervista.org\/creare-una-tabella-con-python\/', 'Creare tabelle html con python'],\r\n['https:\/\/pythonprogramming.altervista.org\/make-an-image-with-text-with-python\/', 'Create an image with text'],\r\n['https:\/\/pythonprogramming.altervista.org\/create-an-exe-with-pyinstaller\/', 'Exe from .py (pyinstaller)'],\r\n['https:\/\/pythonprogramming.altervista.org\/create-a-test-in-html-from-a-txt-file\/', 'Format test in html from txt file'],\r\n['https:\/\/pythonprogramming.altervista.org\/freezing-dependencies-hell-on-python-2018\/', 'Freeze dependencies'],\r\n['https:\/\/pythonprogramming.altervista.org\/google-text-to-speech-example-of-gui-to-create-mp3-from-text\/', 'GUI to create MP3 (gtts)'],\r\n['https:\/\/pythonprogramming.altervista.org\/git-basic-commands-to-keep-track-of-your-project\/', 'Git and Github'],\r\n['https:\/\/pythonprogramming.altervista.org\/grab-a-web-page-without-strange-characters\/', 'Grab a web page without strange characters'],\r\n['https:\/\/pythonprogramming.altervista.org\/grab-the-text-from-a-word-document\/', 'Grab text from Word documents'],\r\n['https:\/\/pythonprogramming.altervista.org\/grab-data-text-from-the-web-with-python-and-urllib\/', 'Grab web text'],\r\n['https:\/\/pythonprogramming.altervista.org\/1563-2\/', 'Html Tables with Python'],\r\n['https:\/\/pythonprogramming.altervista.org\/join-all-images-vertically-or-horizontally\/', 'Join Images'],\r\n['https:\/\/pythonprogramming.altervista.org\/repl-with-sublime-keybinding-to-use-python-interactively\/', 'Keybind Sublime'],\r\n['https:\/\/pythonprogramming.altervista.org\/how-to-get-all-the-file-in-a-directory\/', 'List all files in the directory'],\r\n['https:\/\/pythonprogramming.altervista.org\/all-the-files-in-your-hard-drive-with-os-walk\/', \"List all hard drive's files\"],\r\n['https:\/\/pythonprogramming.altervista.org\/transform-a-png-in-a-thumbnail\/', 'Make a thumbnail (PIL)'],\r\n['https:\/\/pythonprogramming.altervista.org\/a-simple-calculator-with-tkinter\/', 'Mini-Calculator'],\r\n['https:\/\/pythonprogramming.altervista.org\/how-to-merge-all-pdf-files-present-in-a-folder\/', 'Pdf merger'],\r\n['https:\/\/pythonprogramming.altervista.org\/tkinter-a-program-start-mp4-with-ffplay\/', 'Play video with ffplay \/ os'],\r\n['https:\/\/pythonprogramming.altervista.org\/png-to-gif\/', 'Png to Gif (PIL)'],\r\n['https:\/\/pythonprogramming.altervista.org\/using-the-re-module-to-grab-numbers-in-a-text-and-make-different-tests-with-few-code\/', 'Practical example with Regex'],\r\n['https:\/\/pythonprogramming.altervista.org\/python-to-make-svg-easier-for-html-pages\/', 'Python and SVG'],\r\n['https:\/\/pythonprogramming.altervista.org\/make-python-use-your-modules\/', 'Python modules finder'],\r\n['https:\/\/pythonprogramming.altervista.org\/how-to-read-and-write-files-in-python\/', 'Read and write files'],\r\n['https:\/\/pythonprogramming.altervista.org\/rename-all-files-in-a-directory-with-python\/', 'Rename all files'],\r\n['https:\/\/pythonprogramming.altervista.org\/find-all-the-files-on-your-computer\/', 'Search all files of a type'],\r\n['https:\/\/pythonprogramming.altervista.org\/split-square-images-into-many-images-with-python-and-image_slicer\/', 'Split images'],\r\n['https:\/\/pythonprogramming.altervista.org\/split-an-image-and-rename-the-output-images\/', 'Split images'],\r\n['https:\/\/pythonprogramming.altervista.org\/python-inserting-subtitles-to-youtube-videos-on-your-wordpress-site\/', 'Subtitles for Youtube'],\r\n['https:\/\/pythonprogramming.altervista.org\/from-text-to-mp3-with-gtts-reading-external-file\/', 'Text to Mp3 (gtts)'],\r\n['https:\/\/pythonprogramming.altervista.org\/if-you-get-an-error-using-gtts-module\/', 'The gtts error'],\r\n['https:\/\/pythonprogramming.altervista.org\/create-a-true-false-test-with-random-order-of-sentences-with-python\/', 'True false test with Python'],\r\n['https:\/\/pythonprogramming.altervista.org\/unzip-and-unrar-to-extract-zipped-files-with-python-and-7zip\/', 'Unzip and Unrar'],\r\n['https:\/\/pythonprogramming.altervista.org\/use-your-own-module-on-python\/', 'Use your own modules'],\r\n['https:\/\/pythonprogramming.altervista.org\/download-a-video-from-youtube\/', 'Youtube video download']\r\n\t\t];\r\n<\/script>\r\n\r\n\r\n<script>\r\n\t\r\nif (typeof next2 != \"undefined\"){let next2 = 0;}\r\n\t\r\nnext2 = 0;\r\n\thtml = \"\";\/\/<b style='color:coral;font-size:1.2em'>Other posts about \" + title + \"<\/b><br>\";\r\nfor (address of links) \r\n{\r\n\r\n\tif (next2 == 1){\r\n\t\thtml += \"<div style='background:coral'>\";\r\n\t\thtml += \"Next link => <a href='\" + address[0] + \"'>\" + address[1] + \"<\/a>\";\r\n\t\thtml += \"<\/div><br>\";\r\n\t\tnext2 = 0;\r\n\t}\r\n\tif (address[0] == document.URL) {\r\n\t\tnext2 = 1;\r\n\t}\r\n}\r\n\r\nif (typeof next != \"undefined\") {let next = 0;}\r\nif (typeof addressStart != \"undefined\") {let addressStart = \"\";}\r\nnext = 0;\r\naddressStart = \"<a href='\";\r\nfor (address of links) {\r\n\tif (next == 1){\r\n\t\thtml += \">>>\" + addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t\tnext = 0;\r\n\t}\r\n\telse if (addressStart + address[0] != document.URL)\r\n\t{\r\n\t\thtml += addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tnext = 1;\r\n\t\tnext_address = address[0]\r\n\t\tnext_title = address[1]\r\n\t\thtml += \"<span style='color:gray'>\" + address[1] + \"<\/span><br>\";\r\n\t}\r\n\r\n}\r\n\r\n\thtml += `<span style=\"font-size:8px\">Powered by <a href=\"https:\/\/pythonprogramming.altervista.org\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png\" alt=\"\" width=\"70\" height=\"25\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png 156w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2-150x56.png 150w\" sizes=\"auto, (max-width: 70px) 100vw, 70px\" \/>pythonprogramming.altervista.org<\/a><\/span>`\r\n\thtml = \"<div style='background:yellow'>\" + html + \"<\/div>\";\r\n\tdocument.write(html)\r\n<\/script>\r\n\r\n\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"A simple basic program to highlight code to copy and paste it into an html page to show the code in color with python\n<a class=\"moretag\" href=\"https:\/\/pythonprogramming.altervista.org\/highlight-code-in-html-page-using-a-python-script\/\"> [...]<\/a>","protected":false},"author":1,"featured_media":3854,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,370,542],"tags":[106,583,321,4,421,51],"class_list":["post-3851","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-examples","category-html","category-html-with-python","tag-code","tag-highlight","tag-html","tag-python","tag-site","tag-tkinter"],"avopt_banners_inside_post":true,"avopt_banners_on_page":true,"av_copy_from":"","av_sharing_message":"","av_sharing_allowed":false,"av_sharing_on":{"fb":[],"tw":[]},"av_allow_affiliate_banner":false,"av_allow_affiliate_multi_banner":false,"av_show_affiliation_buy_button":false,"av_post_rating":true,"av_have_post_rating_value":false,"av_is_artificial_intelligence_content":false,"_links":{"self":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/3851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/comments?post=3851"}],"version-history":[{"count":7,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/3851\/revisions"}],"predecessor-version":[{"id":3862,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/3851\/revisions\/3862"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media\/3854"}],"wp:attachment":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media?parent=3851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/categories?post=3851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/tags?post=3851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}