{"id":1391,"date":"2013-11-15T09:33:28","date_gmt":"2013-11-15T09:33:28","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=1391"},"modified":"2016-09-14T12:52:24","modified_gmt":"2016-09-14T12:52:24","slug":"python-erklarungen-und-tutorials","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=1391","title":{"rendered":"Python: Erkl\u00e4rungen und Tutorials"},"content":{"rendered":"<p><a href=\"https:\/\/docs.python.org\/3\/library\/stdtypes.html#sequence-types-list-tuple-range\">Sequence Types \u2014 list, tuple, range<\/a><\/p>\n<p><a href=\"https:\/\/docs.python.org\/2\/tutorial\/datastructures.html#functional-programming-tools\">Data Structures &#8211; List &#8211; Functional Programming Tools<\/a><br \/>\nThere are three built-in functions that are very useful when used with lists: filter(), map(), and reduce().<\/p>\n<p><a href=\"http:\/\/www.secnetix.de\/olli\/Python\/list_comprehensions.hawk\">Python: List Comprehensions<\/a><br \/>\n<a href=\"http:\/\/www.python-kurs.eu\/list_comprehension.php\">Listen-Abstraktion (List Comprehension)<\/a><\/p>\n<h4>How to quit the Python prompt<\/h4>\n<p>To exit the prompt, press Ctrl-d if you are using IDLE or are using a Linux\/BSD shell. In case of the Windows command prompt, press Ctrl-z followed by Enter. <\/p>\n<h4>shebang line<\/h4>\n<p>Python does not use comments except for the special case of the first line here. It is called the shebang line &#8211; whenever the first two characters of the source file are #! followed by the location of a program, this tells your Linux\/Unix system that this program should be run with this interpreter when you execute the program.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/env python\r\n<\/pre>\n<p><a href=\"http:\/\/freshtutorial.com\/execute-python-scriptspy-linux\/\">How to execute Python scripts(.py) in Linux<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/15587877\/run-a-python-script-in-terminal-without-the-python-command\">run a python script in terminal without the python command<\/a><\/p>\n<h4>String Note for Regular Expression Users<\/h4>\n<p>Always use raw strings when dealing with regular expressions. Otherwise, a lot of backwhacking may be required. For example, backreferences can be referred to as &#8216;\\\\1&#8242; or r&#8217;\\1&#8217;. <\/p>\n<h4>Variables: Identifier Naming<\/h4\nExamples of valid identifier names are i, __my_name, name_23 and a1b2_c3.\nExamples of invalid identifier names are 2things, this is spaced out and my-name. \n\n\n\n<h4>Objects<\/p>\n<h4>\nRemember, Python refers to anything used in a program as an object. This is meant in the generic sense. Instead of saying &#8216;the something&#8217;, we say &#8216;the object&#8217;.<br \/>\nPython is strongly object-oriented in the sense that everything is an object including numbers, strings and even functions. <\/p>\n<h4>Indentation<\/h4>\n<p>Whitespace is important in Python. Actually, whitespace at the beginning of the line is important. This is called indentation. Leading whitespace (spaces and tabs) at the beginning of the logical line is used to determine the indentation level of the logical line, which in turn is used to determine the grouping of statements.<br \/>\nThis means that statements which go together must have the same indentation. Each such set of statements is called a block. We will see examples of how blocks are important in later chapters. <\/p>\n<h3>Web Application Framework<\/h3>\n<p>Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions. And before you ask: It&#8217;s BSD licensed!<br \/>\n<a href=\"http:\/\/flask.pocoo.org\/\">Flask (A Python Microframework)<\/a><br \/>\n<a href=\"https:\/\/de.wikipedia.org\/wiki\/Flask\">Wikipedia: Flask<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/34977492\/adding-flask-support-to-an-existing-pycharm-project\">Adding Flask support to an existing Pycharm project<\/a><\/p>\n<h3>Links<\/h3>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/419163\/what-does-if-name-main-do\">What does `if __name__ == \u201c__main__\u201d:` do?<\/a><br \/>\n<a href=\"http:\/\/ibiblio.org\/g2swap\/byteofpython\/read\/module-name.html\">A module&#8217;s __name__<\/a><br \/>\n<a href=\"http:\/\/www.python-kurs.eu\/klassen.php\">python-kurs.eu: Objektorientierte Programmierung (OOP)<\/a><br \/>\n<a href=\"http:\/\/openbook.galileocomputing.de\/python\/python_kapitel_12_001.htm\">Galileo &lt;openbook&gt;: Objektorientierung<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sequence Types \u2014 list, tuple, range Data Structures &#8211; List &#8211; Functional Programming Tools There are three built-in functions that are very useful when used with lists: filter(), map(), and reduce(). Python: List Comprehensions Listen-Abstraktion (List Comprehension) How to quit the Python prompt To exit the prompt, press Ctrl-d if you are using IDLE or [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1391","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/1391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1391"}],"version-history":[{"count":16,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/1391\/revisions"}],"predecessor-version":[{"id":5202,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/1391\/revisions\/5202"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}