{"id":68235,"date":"2025-04-29T03:01:00","date_gmt":"2025-04-28T17:01:00","guid":{"rendered":"https:\/\/www.rjmprogramming.com.au\/ITblog\/?p=68235"},"modified":"2025-04-28T11:42:20","modified_gmt":"2025-04-28T01:42:20","slug":"python-list-via-php-revisit-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/python-list-via-php-revisit-tutorial\/","title":{"rendered":"Python List via PHP Revisit Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/listwork.php\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Python List via PHP Revisit Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/google_crawl_blocked_due_to_other_4xx_issue.gif\" title=\"Python List via PHP Revisit Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Python List via PHP Revisit Tutorial<\/p><\/div>\n<p>Back in 2014, with <a title='Python List Primer Tutorial ... http:\/\/www.python.org\/' href='#plpt...:\/\/..\/'>Python List Primer Tutorial &#8230; http:\/\/www.python.org\/<\/a>, there&#8217;s not much doubt we had <i>more hair<\/i> but does that stop you having <i>bad hair days<\/i>?  Well, <a target=\"_blank\" title='Google Crawl' href='https:\/\/developers.google.com\/search\/docs\/crawling-indexing' rel=\"noopener\">Google Crawl<\/a> thinks not!<\/p>\n<p>We got alerted to a webpage created back in 2014 that may have only been coded, seriously, regarding <i>http:<\/i> protocol usage, not working in the current day and age where <i>https:<\/i> protocol is pushed on content providers more and more.  On an Apache web server&#8217;s website the default port used is different, as per &#8230;<\/p>\n<table>\n<tr>\n<th>Protocol<\/th>\n<th><font size=1>Default<\/font> Port<\/th>\n<\/tr>\n<tr>\n<td>http:<\/td>\n<td>80<\/td>\n<\/tr>\n<tr>\n<td>https:<\/td>\n<td>443<\/td>\n<\/tr>\n<\/table>\n<p> &#8230; and am not sure we catered for this back in 2014 &#8230; but these days?!<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\n  $htmlurl=str_replace(\":80\/\",\"\/\",str_replace(\":443\/\",\"\/\",\"ht<font color=black>tp<\/font>:\/\/\" . $_SERVER['SERVER_NAME'] . \":\" . $_SERVER['SERVER_PORT'] . \"\" . str_replace('.php','.html',explode('?',$_SERVER['REQUEST_URI'])[0])));<br \/>\n  \/\/ Python helps write out the HTML in the middle, here ... and then ...<br \/>\n  header(\"Location: \" . $htmlurl);<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p>Anyway, Python syntax changes too, so it was our fault (sorrrrrrrrrrrry) we needed <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/listwork.py-GETME\" rel=\"noopener\">a changed<\/a> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/listwork.py-GETME\" rel=\"noopener\">listwork.py<\/a> <string><i>and<\/i><\/strong> <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/listwork.php-GETME\" rel=\"noopener\">an initial spurt<\/a> and <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/listwork.php--GETME\" rel=\"noopener\">a second &#8220;embellishment&#8221; spurt<\/a> set of goes improving on <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/listwork.php--GETME\" rel=\"noopener\">listwork.php<\/a>&#8216;s <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/listwork.php\" rel=\"noopener\">Python List supervising PHP web application<\/a> you might feel like retrying.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/python-list-via-php-revisit-tutorial' rel=\"noopener\">Python List via PHP Revisit Tutorial<\/a>.<\/p-->\n<hr>\n<p id='plpt...:\/\/..\/'>Previous relevant <a target=\"_blank\" title='Python List Primer Tutorial ... http:\/\/www.python.org\/' href='\/\/www.python.org\/\/' rel=\"noopener\">Python List Primer Tutorial &#8230; http:\/\/www.python.org\/<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/List\/Python_Listwork.jpg\" rel=\"noopener\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Python List Primer Tutorial ... http:\/\/www.python.org\/\" src=\"http:\/\/www.rjmprogramming.com.au\/Python\/List\/Python_Listwork.jpg\" title=\"Python List Primer Tutorial ... http:\/\/www.python.org\/\"  \/><\/a><p class=\"wp-caption-text\">Python List Primer Tutorial ... http:\/\/www.python.org\/<\/p><\/div>\n<p>In this tutorial we examine some functionality code snippets suiting Python list data structure, in response to, really, and extending, a Yahoo Answers <a target=\"_blank\" title='Yahoo Answers question ... thanks' href='https:\/\/au.answers.yahoo.com\/question\/index?qid=20140328234644AAGorRn' rel=\"noopener\">question<\/a>.   Lists, like tuples, are interesting in that different base data types that can&#8217;t cohabit an array can be part of a list, or tuple.   This tutorial builds on the <a title='Python Primer Tutorial' href='#pptbelow'>Python Primer Tutorial<\/a> of previous times, presented below.  Let&#8217;s see immediately below what Wikipedia says about the very interesting Python programming language.<\/p>\n<blockquote><p>Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.<\/p><\/blockquote>\n<p>In this primer  <a target=\"_blank\" title='click picture' href='http:\/\/www.rjmprogramming.com.au\/Python\/List\/Python_Listwork.jpg' rel=\"noopener\">tutorial<\/a> you can see some list usage in Python for a Linux Bash session via the Mac laptop application Terminal.<\/p>\n<p>Here is another Python tutorial called <a target=\"_blank\" title='Python tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=1687' rel=\"noopener\">Python Processing Directory Filespec Primer Tutorial<\/a>.<\/p>\n<p>Link to downloadable Python programming source code which can be renamed to <a target=\"_blank\" title='listwork.py' href='http:\/\/www.rjmprogramming.com.au\/Python\/List\/listwork.py_GETME' rel=\"noopener\">listwork.py<\/a> here.<\/p>\n<p>Want to see it as a live run?   This is more problematic with cgi-bin default language of Perl and server-side language of PHP, as at our web server.   However there is a way to redirect the output of a PHP <i><a target=\"_blank\" href='http:\/\/au1.php.net\/function.exec' title='PHP exec command' rel=\"noopener\">exec<\/a><\/i> call of the Python into some HTML and show that (easiest in the root directory of the website), and then this (kind of awkward (&#8230; but would be pretty easy to make it less awkward)) <a target=\"_blank\" title='listwork.php' href='http:\/\/www.rjmprogramming.com.au\/listwork.php' rel=\"noopener\">live run<\/a> is possible.   The programming PHP source code for this is <a target=\"_blank\" title='listwork.php' href='http:\/\/www.rjmprogramming.com.au\/listwork.php_GETME' rel=\"noopener\">listwork.php<\/a> here.   The Three P&#8217;s ride again (Perl is sick today, so rides as a hologram)!   But she&#8217;s a gem (chortle, chortle).<\/p>\n<p>Link to Python website &#8230; <a target=\"_blank\" href='http:\/\/www.python.org\/' title='Home of Python' rel=\"noopener\">Home of Python &#8230; where quote up the top resides<\/a><br \/>\nLink to a very useful Python tuple tutorial which helped with this tutorial, so, thanks &#8230; <a target=\"_blank\" href='http:\/\/docs.python.org\/release\/1.5.1p1\/tut\/tuples.html' title='Useful Python tuple tutorial' rel=\"noopener\">Useful Python tuple tutorial<\/a><br \/>\nLink to Python jobs done &#8230; <a target=\"_blank\" href='http:\/\/www.rjmprogramming.com.au\/Python\/' title='Python example usage' rel=\"noopener\">Python jobs done<\/a> &#8230; personal experience<br \/>\nAnd yes, it&#8217;s true &#8230; the language name is a fond reference to <a target=\"_blank\" title='Monty Python' href='http:\/\/www.youtube.com\/watch?v=T70-HTlKRXo' rel=\"noopener\">Monty Python<\/a><br \/>\n<!--\/p--><\/p>\n<hr \/>\n<p id=\"pptbelow\">Previous <a target=\"_blank\" title='Python Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=673' rel=\"noopener\">Python Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/Python\/Examples\/\" rel=\"noopener\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Python Primer Tutorial ... http:\/\/www.python.org\/\" src=\"http:\/\/www.rjmprogramming.com.au\/Python\/Python_TclTk_HangMan.JPG\" title=\"Python Primer Tutorial ... http:\/\/www.python.org\/\"  \/><\/a><p class=\"wp-caption-text\">Python Primer Tutorial ... http:\/\/www.python.org\/<\/p><\/div>\n<p>Have you heard of Python?<\/p>\n<blockquote><p>Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.<\/p><\/blockquote>\n<p>Have used it for <a target=\"_blank\" title='Python Tkinter GUI' href='http:\/\/docs.activestate.com\/activepython\/2.6\/python\/library\/tkinter.html' rel=\"noopener\">Games Programming<\/a> and it is great at <a target=\"_blank\" title='Python and the SAX API parsing XML' href='http:\/\/mail.python.org\/pipermail\/python-dev\/2000-October\/009946.html' rel=\"noopener\">parsing XML via the SAX API<\/a>.<\/p>\n<p>Python has some really interesting data structures such as tuples, lists, sets, dictionaries for instance &#8230; read more <a target=\"_blank\" title='Python data types' href='http:\/\/zetcode.com\/lang\/python\/datatypes\/' rel=\"noopener\">here<\/a>.<\/p>\n<p>In this primer  <a target=\"_blank\" title='click picture' href='http:\/\/www.rjmprogramming.com.au\/Python\/Examples\/' rel=\"noopener\">tutorial<\/a> you can see some snapshots showing examples of use.<\/p>\n<p>Here is another Python tutorial called <a target=\"_blank\" title='Python tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=1687' rel=\"noopener\">Python Processing Directory Filespec Primer Tutorial<\/a>.<\/p>\n<p>Link to Python website &#8230; <a target=\"_blank\" href='http:\/\/www.python.org\/' title='Home of Python' rel=\"noopener\">Home of Python &#8230; where quote up the top resides<\/a><br \/>\nLink to Python jobs done &#8230; <a target=\"_blank\" href='http:\/\/www.rjmprogramming.com.au\/Python\/' title='Python example usage' rel=\"noopener\">Python jobs done<\/a> &#8230; personal experience<br \/>\nAnd yes, it&#8217;s true &#8230; the language name is a fond reference to <a target=\"_blank\" title='Monty Python' href='http:\/\/www.youtube.com\/watch?v=T70-HTlKRXo' rel=\"noopener\">Monty Python<\/a>\n<\/p>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d7049' onclick='var dv=document.getElementById(\"d7049\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=Python\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d7049' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d68235' onclick='var dv=document.getElementById(\"d68235\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/Itblog\/tag\/protocol\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d68235' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Back in 2014, with Python List Primer Tutorial &#8230; http:\/\/www.python.org\/, there&#8217;s not much doubt we had more hair but does that stop you having bad hair days? Well, Google Crawl thinks not! We got alerted to a webpage created back &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/python-list-via-php-revisit-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[1980,1929,405,513,710,932,1772,997,1002,1012,5173,1262,1319,1357,1421],"class_list":["post-68235","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-crawl","tag-error","tag-exec","tag-google","tag-list","tag-php","tag-port","tag-programming","tag-protocol","tag-python","tag-supervise","tag-textarea","tag-tutorial","tag-validate","tag-website"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/68235"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=68235"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/68235\/revisions"}],"predecessor-version":[{"id":68243,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/68235\/revisions\/68243"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=68235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=68235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=68235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}