# German translation for Python documentation. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR Swen Bachmann <142266608+sba72@users.noreply.github.com>, 2026. # # Translators: # python-doc bot, 2025 # msgid "" msgstr "" "Project-Id-Version: Python 3.14\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-09-05 16:53+0200\n" "PO-Revision-Date: 2026-07-31 00:02+0000\n" "Last-Translator: Swen Bachmann <142266608+sba72@users.noreply.github.com>\n" "Language-Team: German (https://app.transifex.com/python-doc/teams/5390/de/)\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../../tutorial/introduction.rst:5 msgid "An Informal Introduction to Python" msgstr "Eine informelle Einführung in Python" #: ../../tutorial/introduction.rst:7 msgid "" "In the following examples, input and output are distinguished by the " "presence or absence of prompts (:term:`>>>` and :term:`...`): to repeat the " "example, you must type everything after the prompt, when the prompt appears; " "lines that do not begin with a prompt are output from the interpreter. Note " "that a secondary prompt on a line by itself in an example means you must " "type a blank line; this is used to end a multi-line command." msgstr "" "In den folgenden Beispielen werden Eingabe und Ausgabe durch das " "Vorhandensein oder Fehlen von Prompts (:term:`>>>` und :term:`...`) " "unterschieden: Um das Beispiel nachzuvollziehen, musst du alles eingeben, " "was nach dem Prompt steht, sobald dieser erscheint. Zeilen, die nicht mit " "einem Prompt beginnen, sind Ausgaben des Interpreters. Beachte, dass ein " "zweiter Prompt in einer eigenen Zeile bedeutet, dass du eine Leerzeile " "eingeben musst; dies dient dazu, einen mehrzeiligen Befehl zu beenden." #: ../../tutorial/introduction.rst:16 msgid "" "You can use the \"Copy\" button (it appears in the upper-right corner when " "hovering over or tapping a code example), which strips prompts and omits " "output, to copy and paste the input lines into your interpreter." msgstr "" "Du kannst die Schaltfläche „Copy“ nutzen (sie erscheint in der oberen " "rechten Ecke, wenn du mit der Maus über ein Codebeispiel fährst oder darauf " "tippst), die Prompts entfernt und Ausgaben auslässt, um die Eingabezeilen in " "deinen Interpreter zu kopieren und einzufügen." #: ../../tutorial/introduction.rst:22 msgid "" "Many of the examples in this manual, even those entered at the interactive " "prompt, include comments. Comments in Python start with the hash character, " "``#``, and extend to the end of the physical line. A comment may appear at " "the start of a line or following whitespace or code, but not within a string " "literal. A hash character within a string literal is just a hash character. " "Since comments are to clarify code and are not interpreted by Python, they " "may be omitted when typing in examples." msgstr "" "Viele der Beispiele in diesem Handbuch enthalten Kommentare, selbst wenn sie " "an der interaktiven Eingabeaufforderung eingegeben werden. Kommentare " "beginnen in Python mit dem Raute-Zeichen ``#`` und erstrecken sich bis zum " "Ende der physischen Zeile. Ein Kommentar kann am Anfang einer Zeile oder " "nach Leerzeichen oder Code stehen, jedoch nicht innerhalb eines String-" "Literals. Ein Raute-Zeichen innerhalb eines String-Literals ist einfach nur " "ein Raute-Zeichen. Da Kommentare der Erklärung von Code dienen und nicht von " "Python interpretiert werden, können sie beim Abtippen der Beispiele " "weggelassen werden." #: ../../tutorial/introduction.rst:30 msgid "Some examples::" msgstr "Einige Beispiele::" #: ../../tutorial/introduction.rst:32 msgid "" "# this is the first comment\n" "spam = 1 # and this is the second comment\n" " # ... and now a third!\n" "text = \"# This is not a comment because it's inside quotes.\"" msgstr "" "# Dies ist der erste Kommentar\n" "spam = 1 # und dies ist der zweite Kommentar\n" " # ... und nun ein dritter!\n" "text = \"# Dies ist kein Kommentar, da es in Anführungszeichen steht.\"" #: ../../tutorial/introduction.rst:41 msgid "Using Python as a Calculator" msgstr "Python als Taschenrechner verwenden" #: ../../tutorial/introduction.rst:43 msgid "" "Let's try some simple Python commands. Start the interpreter and wait for " "the primary prompt, ``>>>``. (It shouldn't take long.)" msgstr "" "Probieren wir einige einfache Python-Befehle aus. Starte den Interpreter und " "warte auf den primären Prompt, ``>>>``. (Es sollte nicht lange dauern.)" #: ../../tutorial/introduction.rst:50 msgid "Numbers" msgstr "Zahlen" #: ../../tutorial/introduction.rst:52 msgid "" "The interpreter acts as a simple calculator: you can type an expression into " "it and it will write the value. Expression syntax is straightforward: the " "operators ``+``, ``-``, ``*`` and ``/`` can be used to perform arithmetic; " "parentheses (``()``) can be used for grouping. For example::" msgstr "" "Der Interpreter fungiert als einfacher Taschenrechner: Du kannst einen " "Ausdruck eingeben, und er gibt den Wert zurück. Die Ausdruckssyntax ist " "unkompliziert: Die Operatoren ``+``, ``-``, ``*`` und ``/`` können für " "Rechenoperationen verwendet werden; Klammern (``()``) können zum Gruppieren " "verwendet werden. Zum Beispiel::" #: ../../tutorial/introduction.rst:58 msgid "" ">>> 2 + 2\n" "4\n" ">>> 50 - 5*6\n" "20\n" ">>> (50 - 5*6) / 4\n" "5.0\n" ">>> 8 / 5 # division always returns a floating-point number\n" "1.6" msgstr "" ">>> 2 + 2\n" "4\n" ">>> 50 - 5*6\n" "20\n" ">>> (50 - 5*6) / 4\n" "5.0\n" ">>> 8 / 5 # division always returns a floating-point number\n" "1.6" #: ../../tutorial/introduction.rst:67 msgid "" "The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the " "ones with a fractional part (e.g. ``5.0``, ``1.6``) have type :class:" "`float`. We will see more about numeric types later in the tutorial." msgstr "" "Ganzzahlen (z. B. ``2``, ``4``, ``20``) haben den Typ :class:`int`, Zahlen " "mit Nachkommastellen (z. B. ``5.0``, ``1.6``) den Typ :class:`float`. Mehr " "zu numerischen Typen erfährst du später in diesem Tutorial." #: ../../tutorial/introduction.rst:71 msgid "" "Division (``/``) always returns a float. To do :term:`floor division` and " "get an integer result you can use the ``//`` operator; to calculate the " "remainder you can use ``%``::" msgstr "" "Eine Division (``/``) liefert immer eine Gleitkommazahl zurück. Um eine :" "term:`Ganzzahldivision ` durchzuführen und ein ganzzahliges " "Ergebnis zu erhalten, kannst du den Operator ``//`` verwenden; zur " "Berechnung des Restes nutzt du ``%``::" #: ../../tutorial/introduction.rst:75 msgid "" ">>> 17 / 3 # classic division returns a float\n" "5.666666666666667\n" ">>>\n" ">>> 17 // 3 # floor division discards the fractional part\n" "5\n" ">>> 17 % 3 # the % operator returns the remainder of the division\n" "2\n" ">>> 5 * 3 + 2 # floored quotient * divisor + remainder\n" "17" msgstr "" ">>> 17 / 3 # Klassische Division liefert eine Gleitkommazahl zurück\n" "5.666666666666667\n" ">>>\n" ">>> 17 // 3 # Ganzzahldivision schneidet den Nachkommateil ab\n" "5\n" ">>> 17 % 3 # Der %-Operator liefert den Rest der Division zurück\n" "2\n" ">>> 5 * 3 + 2 # Abgerundeter Quotient * Divisor + Rest\n" "17" #: ../../tutorial/introduction.rst:85 msgid "" "With Python, it is possible to use the ``**`` operator to calculate powers " "[#]_::" msgstr "" "In Python kann der Operator ``**`` verwendet werden, um Potenzen zu " "berechnen [#]_::" #: ../../tutorial/introduction.rst:87 msgid "" ">>> 5 ** 2 # 5 squared\n" "25\n" ">>> 2 ** 7 # 2 to the power of 7\n" "128" msgstr "" ">>> 5 ** 2 # 5 zum Quadrat\n" "25\n" ">>> 2 ** 7 # 2 hoch 7\n" "128" #: ../../tutorial/introduction.rst:92 msgid "" "The equal sign (``=``) is used to assign a value to a variable. Afterwards, " "no result is displayed before the next interactive prompt::" msgstr "" "Das Gleichheitszeichen (``=``) wird verwendet, um einer Variablen einen Wert " "zuzuweisen. Dabei wird vor dem nächsten interaktiven Prompt kein Ergebnis " "angezeigt::" #: ../../tutorial/introduction.rst:95 msgid "" ">>> width = 20\n" ">>> height = 5 * 9\n" ">>> width * height\n" "900" msgstr "" ">>> width = 20\n" ">>> height = 5 * 9\n" ">>> width * height\n" "900" #: ../../tutorial/introduction.rst:100 msgid "" "If a variable is not \"defined\" (assigned a value), trying to use it will " "give you an error::" msgstr "" "Wenn eine Variable nicht „definiert“ ist (ihr kein Wert zugewiesen wurde), " "führt der Versuch, diese zu verwenden, zu einem Fehler::" #: ../../tutorial/introduction.rst:103 msgid "" ">>> n # try to access an undefined variable\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "NameError: name 'n' is not defined" msgstr "" ">>> n # Versuch, auf eine undefinierte Variable zuzugreifen\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "NameError: name 'n' is not defined" #: ../../tutorial/introduction.rst:108 msgid "" "There is full support for floating point; operators with mixed type operands " "convert the integer operand to floating point::" msgstr "" "Gleitkommazahlen werden vollständig unterstützt; Operatoren mit gemischten " "Operandentypen wandeln den Ganzzahl-Operanden in eine Gleitkommazahl um::" #: ../../tutorial/introduction.rst:111 msgid "" ">>> 4 * 3.75 - 1\n" "14.0" msgstr "" ">>> 4 * 3.75 - 1\n" "14.0" #: ../../tutorial/introduction.rst:114 msgid "" "In interactive mode, the last printed expression is assigned to the variable " "``_``. This means that when you are using Python as a desk calculator, it " "is somewhat easier to continue calculations, for example::" msgstr "" "Im interaktiven Modus wird der letzte ausgegebene Ausdruck einer Variablen " "``_`` zugewiesen. Wenn du Python als Taschenrechner nutzt, erleichtert dies " "das Weiterrechnen, zum Beispiel::" #: ../../tutorial/introduction.rst:118 msgid "" ">>> tax = 12.5 / 100\n" ">>> price = 100.50\n" ">>> price * tax\n" "12.5625\n" ">>> price + _\n" "113.0625\n" ">>> round(_, 2)\n" "113.06" msgstr "" ">>> tax = 12.5 / 100\n" ">>> price = 100.50\n" ">>> price * tax\n" "12.5625\n" ">>> price + _\n" "113.0625\n" ">>> round(_, 2)\n" "113.06" #: ../../tutorial/introduction.rst:127 msgid "" "This variable should be treated as read-only by the user. Don't explicitly " "assign a value to it --- you would create an independent local variable with " "the same name masking the built-in variable with its magic behavior." msgstr "" "Diese Variable sollte vom Benutzer als schreibgeschützt behandelt werden. " "Weise ihr nicht explizit einen Wert zu --- du würdest eine unabhängige " "lokale Variable desselben Namens erzeugen, die die integrierte Variable mit " "ihrem magischen Verhalten verdeckt." #: ../../tutorial/introduction.rst:131 msgid "" "In addition to :class:`int` and :class:`float`, Python supports other types " "of numbers, such as :class:`~decimal.Decimal` and :class:`~fractions." "Fraction`. Python also has built-in support for :ref:`complex numbers " "`, and uses the ``j`` or ``J`` suffix to indicate the " "imaginary part (e.g. ``3+5j``)." msgstr "" "Neben :class:`int` und :class:`float` unterstützt Python weitere Typen von " "Zahlen, wie :class:`~decimal.Decimal` und :class:`~fractions.Fraction`. " "Python bietet auch integrierte Unterstützung für :ref:`komplexe Zahlen " "` und verwendet das Suffix ``j`` oder ``J``, um den " "Imaginärteil anzugeben (z. B. ``3+5j``)." #: ../../tutorial/introduction.rst:141 msgid "Text" msgstr "Text" #: ../../tutorial/introduction.rst:143 msgid "" "Python can manipulate text (represented by type :class:`str`, so-called " "\"strings\") as well as numbers. This includes characters \"``!``\", words " "\"``rabbit``\", names \"``Paris``\", sentences \"``Got your back.``\", etc. " "\"``Yay! :)``\". They can be enclosed in single quotes (``'...'``) or double " "quotes (``\"...\"``) with the same result [#]_." msgstr "" "Neben Zahlen kann Python auch Text verarbeiten (dargestellt durch den Typ :" "class:`str`, sogenannte \"Strings\" oder Zeichenketten). Dazu gehören " "Zeichen \"``!``\", Wörter \"``rabbit``\", Namen \"``Paris``\", Sätze \"``Got " "your back.``\" usw. \"``Yay! :)``\". Sie können in einfache " "Anführungszeichen (``'...'``) oder doppelte Anführungszeichen (``\"...\"``) " "eingeschlossen werden, mit dem gleichen Ergebnis [#]_." #: ../../tutorial/introduction.rst:149 msgid "" ">>> 'spam eggs' # single quotes\n" "'spam eggs'\n" ">>> \"Paris rabbit got your back :)! Yay!\" # double quotes\n" "'Paris rabbit got your back :)! Yay!'\n" ">>> '1975' # digits and numerals enclosed in quotes are also strings\n" "'1975'" msgstr "" ">>> 'spam eggs' # einfache Anführungszeichen\n" "'spam eggs'\n" ">>> \"Paris rabbit got your back :)! Yay!\" # doppelte Anführungszeichen\n" "'Paris rabbit got your back :)! Yay!'\n" ">>> '1975' # in Anführungszeichen eingeschlossene Ziffern und Zahlen sind " "ebenfalls Strings\n" "'1975'" #: ../../tutorial/introduction.rst:158 msgid "" "To quote a quote, we need to \"escape\" it, by preceding it with ``\\``. " "Alternatively, we can use the other type of quotation marks::" msgstr "" "Um ein Anführungszeichen innerhalb eines Strings zu verwenden, müssen wir es " "\"maskieren\", indem ein ``\\`` vorangestellt wird. Alternativ können wir " "die andere Art von Anführungszeichen verwenden::" #: ../../tutorial/introduction.rst:161 msgid "" ">>> 'doesn\\'t' # use \\' to escape the single quote...\n" "\"doesn't\"\n" ">>> \"doesn't\" # ...or use double quotes instead\n" "\"doesn't\"\n" ">>> '\"Yes,\" they said.'\n" "'\"Yes,\" they said.'\n" ">>> \"\\\"Yes,\\\" they said.\"\n" "'\"Yes,\" they said.'\n" ">>> '\"Isn\\'t,\" they said.'\n" "'\"Isn\\'t,\" they said.'" msgstr "" ">>> 'doesn\\'t' # vergleiche \\' zum Maskieren des einfachen " "Anführungszeichens...\n" "\"doesn't\"\n" ">>> \"doesn't\" # ...oder verwende stattdessen doppelte Anführungszeichen\n" "\"doesn't\"\n" ">>> '\"Yes,\" they said.'\n" "'\"Yes,\" they said.'\n" ">>> \"\\\"Yes,\\\" they said.\"\n" "'\"Yes,\" they said.'\n" ">>> '\"Isn\\'t,\" they said.'\n" "'\"Isn\\'t,\" they said.'" #: ../../tutorial/introduction.rst:172 msgid "" "In the Python shell, the string definition and output string can look " "different. The :func:`print` function produces a more readable output, by " "omitting the enclosing quotes and by printing escaped and special " "characters::" msgstr "" "In der Python-Shell können die String-Definition und die String-Ausgabe " "unterschiedlich aussehen. Die Funktion :func:`print` erzeugt eine lesbarere " "Ausgabe, indem sie die umschließenden Anführungszeichen weglässt und " "maskierte sowie Sonderzeichen ausgibt::" #: ../../tutorial/introduction.rst:176 msgid "" ">>> s = 'First line.\\nSecond line.' # \\n means newline\n" ">>> s # without print(), special characters are included in the string\n" "'First line.\\nSecond line.'\n" ">>> print(s) # with print(), special characters are interpreted, so \\n " "produces new line\n" "First line.\n" "Second line." msgstr "" ">>> s = 'First line.\\nSecond line.' # \\n steht für Zeilenumbruch\n" ">>> s # ohne print() sind Sonderzeichen im String enthalten\n" "'First line.\\nSecond line.'\n" ">>> print(s) # mit print() werden Sonderzeichen interpretiert, sodass \\n " "einen Zeilenumbruch erzeugt\n" "First line.\n" "Second line." #: ../../tutorial/introduction.rst:183 msgid "" "If you don't want characters prefaced by ``\\`` to be interpreted as special " "characters, you can use *raw strings* by adding an ``r`` before the first " "quote::" msgstr "" "Wenn du nicht möchtest, dass Zeichen mit vorangestelltem ``\\`` als " "Sonderzeichen interpretiert werden, kannst du *Raw-Strings* verwenden, indem " "du ein ``r`` vor das erste Anführungszeichen setzt::" #: ../../tutorial/introduction.rst:187 msgid "" ">>> print('C:\\this\\name') # here \\t means tab, \\n means newline\n" "C: his\n" "ame\n" ">>> print(r'C:\\this\\name') # note the r before the quote\n" "C:\\this\\name" msgstr "" ">>> print('C:\\this\\name') # hier bedeutet \\t Tabulator, \\n " "Zeilenumbruch\n" "C: his\n" "ame\n" ">>> print(r'C:\\this\\name') # beachte das r vor dem Anführungszeichen\n" "C:\\this\\name" #: ../../tutorial/introduction.rst:193 msgid "" "There is one subtle aspect to raw strings: a raw string may not end in an " "odd number of ``\\`` characters; see :ref:`the FAQ entry ` for more information and workarounds." msgstr "" "Es gibt einen subtilen Aspekt bei Raw-Strings: Ein Raw-String darf nicht auf " "eine ungerade Anzahl von ``\\``-Zeichen enden; siehe :ref:`den FAQ-Eintrag " "` für weitere Informationen und " "Workarounds." #: ../../tutorial/introduction.rst:198 msgid "" "String literals can span multiple lines. One way is using triple-quotes: " "``\"\"\"...\"\"\"`` or ``'''...'''``. End-of-line characters are " "automatically included in the string, but it's possible to prevent this by " "adding a ``\\`` at the end of the line. In the following example, the " "initial newline is not included::" msgstr "" "String-Literale können sich über mehrere Zeilen erstrecken. Eine Möglichkeit " "ist die Verwendung von dreifachen Anführungszeichen: ``\"\"\"...\"\"\"`` " "oder ``'''...'''``. Zeilenendzeichen werden automatisch in den String " "eingeschlossen, aber es ist möglich, dies zu verhindern, indem ein ``\\`` am " "Ende der Zeile angefügt wird. Im folgenden Beispiel ist der einleitende " "Zeilenumbruch nicht enthalten::" #: ../../tutorial/introduction.rst:204 msgid "" ">>> print(\"\"\"\\\n" "... Usage: thingy [OPTIONS]\n" "... -h Display this usage message\n" "... -H hostname Hostname to connect to\n" "... \"\"\")\n" "Usage: thingy [OPTIONS]\n" " -h Display this usage message\n" " -H hostname Hostname to connect to\n" "\n" ">>>" msgstr "" ">>> print(\"\"\"\\\n" "... Usage: thingy [OPTIONS]\n" "... -h Display this usage message\n" "... -H hostname Hostname to connect to\n" "... \"\"\")\n" "Usage: thingy [OPTIONS]\n" " -h Display this usage message\n" " -H hostname Hostname to connect to\n" "\n" ">>>" #: ../../tutorial/introduction.rst:215 msgid "" "Strings can be concatenated (glued together) with the ``+`` operator, and " "repeated with ``*``::" msgstr "" "Strings können mit dem Operator ``+`` verknüpft (zusammengefügt) und mit " "``*`` wiederholt werden::" #: ../../tutorial/introduction.rst:218 msgid "" ">>> # 3 times 'un', followed by 'ium'\n" ">>> 3 * 'un' + 'ium'\n" "'unununium'" msgstr "" ">>> # 3-mal 'un', gefolgt von 'ium'\n" ">>> 3 * 'un' + 'ium'\n" "'unununium'" #: ../../tutorial/introduction.rst:222 msgid "" "Two or more *string literals* (i.e. the ones enclosed between quotes) next " "to each other are automatically concatenated. ::" msgstr "" "Zwei oder mehr *String-Literale* (also solche in Anführungszeichen), die " "nebeneinanderstehen, werden automatisch verknüpft. ::" #: ../../tutorial/introduction.rst:225 msgid "" ">>> 'Py' 'thon'\n" "'Python'" msgstr "" ">>> 'Py' 'thon'\n" "'Python'" #: ../../tutorial/introduction.rst:228 msgid "" "This feature is particularly useful when you want to break long strings::" msgstr "" "Dieses Feature ist besonders nützlich, wenn du lange Strings umbrechen " "möchtest::" #: ../../tutorial/introduction.rst:230 msgid "" ">>> text = ('Put several strings within parentheses '\n" "... 'to have them joined together.')\n" ">>> text\n" "'Put several strings within parentheses to have them joined together.'" msgstr "" ">>> text = ('Put several strings within parentheses '\n" "... 'to have them joined together.')\n" ">>> text\n" "'Put several strings within parentheses to have them joined together.'" #: ../../tutorial/introduction.rst:235 msgid "" "This only works with two literals though, not with variables or expressions::" msgstr "" "Dies funktioniert jedoch nur mit zwei Literalen, nicht mit Variablen oder " "Ausdrücken::" #: ../../tutorial/introduction.rst:237 msgid "" ">>> prefix = 'Py'\n" ">>> prefix 'thon' # can't concatenate a variable and a string literal\n" " File \"\", line 1\n" " prefix 'thon'\n" " ^^^^^^\n" "SyntaxError: invalid syntax\n" ">>> ('un' * 3) 'ium'\n" " File \"\", line 1\n" " ('un' * 3) 'ium'\n" " ^^^^^\n" "SyntaxError: invalid syntax" msgstr "" ">>> prefix = 'Py'\n" ">>> prefix 'thon' # Variable und String-Literal können so nicht verknüpft " "werden\n" " File \"\", line 1\n" " prefix 'thon'\n" " ^^^^^^\n" "SyntaxError: invalid syntax\n" ">>> ('un' * 3) 'ium'\n" " File \"\", line 1\n" " ('un' * 3) 'ium'\n" " ^^^^^\n" "SyntaxError: invalid syntax" #: ../../tutorial/introduction.rst:249 msgid "" "If you want to concatenate variables or a variable and a literal, use ``+``::" msgstr "" "Wenn du Variablen oder eine Variable und ein Literal verknüpfen möchtest, " "verwende ``+``::" #: ../../tutorial/introduction.rst:251 msgid "" ">>> prefix + 'thon'\n" "'Python'" msgstr "" ">>> prefix + 'thon'\n" "'Python'" #: ../../tutorial/introduction.rst:254 msgid "" "Strings can be *indexed* (subscripted), with the first character having " "index 0. There is no separate character type; a character is simply a string " "of size one::" msgstr "" "Strings können *indiziert* werden (mit Index), wobei das erste Zeichen den " "Index 0 hat. Es gibt keinen eigenen Zeichentyp; ein Zeichen ist einfach ein " "String der Länge eins::" #: ../../tutorial/introduction.rst:258 msgid "" ">>> word = 'Python'\n" ">>> word[0] # character in position 0\n" "'P'\n" ">>> word[5] # character in position 5\n" "'n'" msgstr "" ">>> word = 'Python'\n" ">>> word[0] # Zeichen an Position 0\n" "'P'\n" ">>> word[5] # Zeichen an Position 5\n" "'n'" #: ../../tutorial/introduction.rst:264 msgid "" "Indices may also be negative numbers, to start counting from the right::" msgstr "Indizes können auch negative Zahlen sein, um von rechts zu zählen::" #: ../../tutorial/introduction.rst:266 msgid "" ">>> word[-1] # last character\n" "'n'\n" ">>> word[-2] # second-last character\n" "'o'\n" ">>> word[-6]\n" "'P'" msgstr "" ">>> word[-1] # letztes Zeichen\n" "'n'\n" ">>> word[-2] # vorletztes Zeichen\n" "'o'\n" ">>> word[-6]\n" "'P'" #: ../../tutorial/introduction.rst:273 msgid "Note that since -0 is the same as 0, negative indices start from -1." msgstr "" "Beachte, dass negative Indizes bei -1 beginnen, da -0 dasselbe wie 0 ist." #: ../../tutorial/introduction.rst:275 msgid "" "In addition to indexing, *slicing* is also supported. While indexing is " "used to obtain individual characters, *slicing* allows you to obtain a " "substring::" msgstr "" "Neben dem Indizieren wird auch *Slicing* (Ausschneiden) unterstützt. Während " "Indizieren dazu dient, einzelne Zeichen zu erhalten, ermöglicht *Slicing* " "das Heraustrennen eines Teilstrings::" #: ../../tutorial/introduction.rst:278 msgid "" ">>> word[0:2] # characters from position 0 (included) to 2 (excluded)\n" "'Py'\n" ">>> word[2:5] # characters from position 2 (included) to 5 (excluded)\n" "'tho'" msgstr "" ">>> word[0:2] # Zeichen von Position 0 (einschließlich) bis 2 " "(ausschließlich)\n" "'Py'\n" ">>> word[2:5] # Zeichen von Position 2 (einschließlich) bis 5 " "(ausschließlich)\n" "'tho'" #: ../../tutorial/introduction.rst:283 msgid "" "Slice indices have useful defaults; an omitted first index defaults to zero, " "an omitted second index defaults to the size of the string being sliced. ::" msgstr "" "Slice-Indizes haben nützliche Standardwerte; ein ausgelassener erster Index " "wird standardmäßig auf null gesetzt, ein ausgelassener zweiter Index " "entspricht standardmäßig der Länge des verwendeten Strings. ::" #: ../../tutorial/introduction.rst:286 msgid "" ">>> word[:2] # character from the beginning to position 2 (excluded)\n" "'Py'\n" ">>> word[4:] # characters from position 4 (included) to the end\n" "'on'\n" ">>> word[-2:] # characters from the second-last (included) to the end\n" "'on'" msgstr "" ">>> word[:2] # Zeichen vom Anfang bis Position 2 (ausschließlich)\n" "'Py'\n" ">>> word[4:] # Zeichen von Position 4 (einschließlich) bis zum Ende\n" "'on'\n" ">>> word[-2:] # Zeichen vom Vorletzten (einschließlich) bis zum Ende\n" "'on'" #: ../../tutorial/introduction.rst:293 msgid "" "Note how the start is always included, and the end always excluded. This " "makes sure that ``s[:i] + s[i:]`` is always equal to ``s``::" msgstr "" "Beachte, dass der Startwert immer eingeschlossen und der Endwert immer " "ausgeschlossen ist. Dies stellt sicher, dass ``s[:i] + s[i:]`` immer gleich " "``s`` ist::" #: ../../tutorial/introduction.rst:296 msgid "" ">>> word[:2] + word[2:]\n" "'Python'\n" ">>> word[:4] + word[4:]\n" "'Python'" msgstr "" ">>> word[:2] + word[2:]\n" "'Python'\n" ">>> word[:4] + word[4:]\n" "'Python'" #: ../../tutorial/introduction.rst:301 msgid "" "One way to remember how slices work is to think of the indices as pointing " "*between* characters, with the left edge of the first character numbered 0. " "Then the right edge of the last character of a string of *n* characters has " "index *n*, for example::" msgstr "" "Eine Möglichkeit, sich die Funktionsweise von Slices zu merken, besteht " "darin, sich die Indizes so vorzustellen, dass sie *zwischen* die Zeichen " "zeigen, wobei die linke Kante des ersten Zeichens die Nummer 0 hat. Die " "rechte Kante des letzten Zeichens eines Strings mit *n* Zeichen hat dann den " "Index *n*, zum Beispiel::" #: ../../tutorial/introduction.rst:306 msgid "" " +---+---+---+---+---+---+\n" " | P | y | t | h | o | n |\n" " +---+---+---+---+---+---+\n" " 0 1 2 3 4 5 6\n" "-6 -5 -4 -3 -2 -1" msgstr "" " +---+---+---+---+---+---+\n" " | P | y | t | h | o | n |\n" " +---+---+---+---+---+---+\n" " 0 1 2 3 4 5 6\n" "-6 -5 -4 -3 -2 -1" #: ../../tutorial/introduction.rst:312 msgid "" "The first row of numbers gives the position of the indices 0...6 in the " "string; the second row gives the corresponding negative indices. The slice " "from *i* to *j* consists of all characters between the edges labeled *i* and " "*j*, respectively." msgstr "" "Die erste Zahlenreihe gibt die Position der Indizes 0...6 im String an, die " "zweite Reihe zeigt die entsprechenden negativen Indizes. Der Slice von *i* " "bis *j* besteht aus allen Zeichen zwischen den mit *i* bzw. *j* " "beschrifteten Kanten." #: ../../tutorial/introduction.rst:317 msgid "" "For non-negative indices, the length of a slice is the difference of the " "indices, if both are within bounds. For example, the length of " "``word[1:3]`` is 2." msgstr "" "Für nicht-negative Indizes ist die Länge eines Slices die Differenz der " "Indizes, sofern beide innerhalb der Grenzen liegen. Zum Beispiel beträgt die " "Länge von ``word[1:3]`` 2." #: ../../tutorial/introduction.rst:321 msgid "Attempting to use an index that is too large will result in an error::" msgstr "" "Der Versuch, einen zu großen Index zu verwenden, führt zu einem Fehler::" #: ../../tutorial/introduction.rst:323 msgid "" ">>> word[42] # the word only has 6 characters\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "IndexError: string index out of range" msgstr "" ">>> word[42] # das Wort hat nur 6 Zeichen\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "IndexError: string index out of range" #: ../../tutorial/introduction.rst:328 msgid "" "However, out of range slice indexes are handled gracefully when used for " "slicing::" msgstr "" "Außerhalb des Bereichs liegende Slice-Indizes werden beim Slicing jedoch " "toleriert::" #: ../../tutorial/introduction.rst:331 msgid "" ">>> word[4:42]\n" "'on'\n" ">>> word[42:]\n" "''" msgstr "" ">>> word[4:42]\n" "'on'\n" ">>> word[42:]\n" "''" #: ../../tutorial/introduction.rst:336 msgid "" "Python strings cannot be changed --- they are :term:`immutable`. Therefore, " "assigning to an indexed position in the string results in an error::" msgstr "" "Python-Strings können nicht verändert werden --- sie sind :term:" "`unveränderlich `. Zuweisungen an eine indizierte Position im " "String führen daher zu einem Fehler::" #: ../../tutorial/introduction.rst:339 msgid "" ">>> word[0] = 'J'\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "TypeError: 'str' object does not support item assignment\n" ">>> word[2:] = 'py'\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "TypeError: 'str' object does not support item assignment" msgstr "" ">>> word[0] = 'J'\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "TypeError: 'str' object does not support item assignment\n" ">>> word[2:] = 'py'\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "TypeError: 'str' object does not support item assignment" #: ../../tutorial/introduction.rst:348 msgid "If you need a different string, you should create a new one::" msgstr "" "Wenn du einen anderen String benötigst, solltest du einen neuen erstellen::" #: ../../tutorial/introduction.rst:350 msgid "" ">>> 'J' + word[1:]\n" "'Jython'\n" ">>> word[:2] + 'py'\n" "'Pypy'" msgstr "" ">>> 'J' + word[1:]\n" "'Jython'\n" ">>> word[:2] + 'py'\n" "'Pypy'" #: ../../tutorial/introduction.rst:355 msgid "The built-in function :func:`len` returns the length of a string::" msgstr "" "Die integrierte Funktion :func:`len` gibt die Länge eines Strings zurück::" #: ../../tutorial/introduction.rst:357 msgid "" ">>> s = 'supercalifragilisticexpialidocious'\n" ">>> len(s)\n" "34" msgstr "" ">>> s = 'supercalifragilisticexpialidocious'\n" ">>> len(s)\n" "34" #: ../../tutorial/introduction.rst:364 msgid ":ref:`textseq`" msgstr ":ref:`textseq`" #: ../../tutorial/introduction.rst:365 msgid "" "Strings are examples of *sequence types*, and support the common operations " "supported by such types." msgstr "" "Strings sind Beispiele für *Sequenztypen* und unterstützen die für solche " "Typen üblichen Operationen." #: ../../tutorial/introduction.rst:368 msgid ":ref:`string-methods`" msgstr ":ref:`string-methods`" #: ../../tutorial/introduction.rst:369 msgid "" "Strings support a large number of methods for basic transformations and " "searching." msgstr "" "Strings unterstützen eine Vielzahl von Methoden für grundlegende " "Umwandlungen und Suchen." #: ../../tutorial/introduction.rst:372 msgid ":ref:`f-strings`" msgstr ":ref:`f-strings`" #: ../../tutorial/introduction.rst:373 msgid "String literals that have embedded expressions." msgstr "String-Literale, die eingebettete Ausdrücke enthalten." #: ../../tutorial/introduction.rst:375 msgid ":ref:`formatstrings`" msgstr ":ref:`formatstrings`" #: ../../tutorial/introduction.rst:376 msgid "Information about string formatting with :meth:`str.format`." msgstr "Informationen zur Formatierung von Strings mit :meth:`str.format`." #: ../../tutorial/introduction.rst:378 msgid ":ref:`old-string-formatting`" msgstr ":ref:`old-string-formatting`" #: ../../tutorial/introduction.rst:379 msgid "" "The old formatting operations invoked when strings are the left operand of " "the ``%`` operator are described in more detail here." msgstr "" "Die alten Formatierungsoperationen, die aufgerufen werden, wenn Strings der " "linke Operand des ``%``-Operators sind, werden hier ausführlicher " "beschrieben." #: ../../tutorial/introduction.rst:386 msgid "Lists" msgstr "Listen" #: ../../tutorial/introduction.rst:388 msgid "" "Python knows a number of *compound* data types, used to group together other " "values. The most versatile is the *list*, which can be written as a list of " "comma-separated values (items) between square brackets. Lists might contain " "items of different types, but usually the items all have the same type. ::" msgstr "" "Python kennt eine Reihe von *zusammengesetzten* Datentypen, die verwendet " "werden, um andere Werte zusammenzufassen. Der vielseitigste ist die *Liste*, " "die als durch Kommas getrennte Liste von Werten (Elementen) in eckigen " "Klammern geschrieben werden kann. Listen können Elemente verschiedener Typen " "enthalten, meist haben die Elemente jedoch denselben Typ. ::" #: ../../tutorial/introduction.rst:393 msgid "" ">>> squares = [1, 4, 9, 16, 25]\n" ">>> squares\n" "[1, 4, 9, 16, 25]" msgstr "" ">>> squares = [1, 4, 9, 16, 25]\n" ">>> squares\n" "[1, 4, 9, 16, 25]" #: ../../tutorial/introduction.rst:397 msgid "" "Like strings (and all other built-in :term:`sequence` types), lists can be " "indexed and sliced::" msgstr "" "Wie Strings (und alle anderen integrierten :term:`Sequenztypen `) " "können Listen indiziert und zerteilt werden::" #: ../../tutorial/introduction.rst:400 msgid "" ">>> squares[0] # indexing returns the item\n" "1\n" ">>> squares[-1]\n" "25\n" ">>> squares[-3:] # slicing returns a new list\n" "[9, 16, 25]" msgstr "" ">>> squares[0] # Indizierung gibt das Element zurück\n" "1\n" ">>> squares[-1]\n" "25\n" ">>> squares[-3:] # Slicing gibt eine neue Liste zurück\n" "[9, 16, 25]" #: ../../tutorial/introduction.rst:407 msgid "Lists also support operations like concatenation::" msgstr "Listen unterstützen auch Operationen wie die Verkettung::" #: ../../tutorial/introduction.rst:409 msgid "" ">>> squares + [36, 49, 64, 81, 100]\n" "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]" msgstr "" ">>> squares + [36, 49, 64, 81, 100]\n" "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]" #: ../../tutorial/introduction.rst:412 msgid "" "Unlike strings, which are :term:`immutable`, lists are a :term:`mutable` " "type, i.e. it is possible to change their content::" msgstr "" "Im Gegensatz zu Strings, die :term:`unveränderlich ` sind, sind " "Listen ein :term:`veränderlicher ` Typ, d. h. ihr Inhalt kann " "geändert werden::" #: ../../tutorial/introduction.rst:415 msgid "" ">>> cubes = [1, 8, 27, 65, 125] # something's wrong here\n" ">>> 4 ** 3 # the cube of 4 is 64, not 65!\n" "64\n" ">>> cubes[3] = 64 # replace the wrong value\n" ">>> cubes\n" "[1, 8, 27, 64, 125]" msgstr "" ">>> cubes = [1, 8, 27, 65, 125] # Hier stimmt etwas nicht\n" ">>> 4 ** 3 # Die dritte Potenz von 4 ist 64, nicht 65!\n" "64\n" ">>> cubes[3] = 64 # Ersetze den falschen Wert\n" ">>> cubes\n" "[1, 8, 27, 64, 125]" #: ../../tutorial/introduction.rst:422 msgid "" "You can also add new items at the end of the list, by using the :meth:`list." "append` *method* (we will see more about methods later)::" msgstr "" "Du kannst auch neue Elemente am Ende der Liste hinzufügen, indem du die :" "meth:`list.append` *Methode* verwenden (mehr zu Methoden werden wir später " "sehen)::" #: ../../tutorial/introduction.rst:425 msgid "" ">>> cubes.append(216) # add the cube of 6\n" ">>> cubes.append(7 ** 3) # and the cube of 7\n" ">>> cubes\n" "[1, 8, 27, 64, 125, 216, 343]" msgstr "" ">>> cubes.append(216) # Füge die dritte Potenz von 6 hinzu\n" ">>> cubes.append(7 ** 3) # und die dritte Potenz von 7\n" ">>> cubes\n" "[1, 8, 27, 64, 125, 216, 343]" #: ../../tutorial/introduction.rst:430 msgid "" "Simple assignment in Python never copies data. When you assign a list to a " "variable, the variable refers to the *existing list*. Any changes you make " "to the list through one variable will be seen through all other variables " "that refer to it.::" msgstr "" "Eine einfache Zuweisung kopiert in Python niemals Daten. Wenn du eine Liste " "einer Variablen zuweisen, bezieht sich die Variable auf die *bestehende " "Liste*. Alle Änderungen, die du an der Liste über eine Variable vornimmst, " "sind über alle anderen Variablen sichtbar, die sich auf sie beziehen.::" #: ../../tutorial/introduction.rst:435 msgid "" ">>> rgb = [\"Red\", \"Green\", \"Blue\"]\n" ">>> rgba = rgb\n" ">>> id(rgb) == id(rgba) # they reference the same object\n" "True\n" ">>> rgba.append(\"Alph\")\n" ">>> rgb\n" "[\"Red\", \"Green\", \"Blue\", \"Alph\"]" msgstr "" ">>> rgb = [\"Red\", \"Green\", \"Blue\"]\n" ">>> rgba = rgb\n" ">>> id(rgb) == id(rgba) # Sie verweisen auf dasselbe Objekt\n" "True\n" ">>> rgba.append(\"Alph\")\n" ">>> rgb\n" "[\"Red\", \"Green\", \"Blue\", \"Alph\"]" #: ../../tutorial/introduction.rst:443 msgid "" "All slice operations return a new list containing the requested elements. " "This means that the following slice returns a :ref:`shallow copy " "` of the list::" msgstr "" "Alle Slicing-Operationen geben eine neue Liste zurück, die die angeforderten " "Elemente enthält. Das bedeutet, dass das folgende Slicing eine :ref:`flache " "Kopie ` der Liste zurückgibt::" #: ../../tutorial/introduction.rst:447 msgid "" ">>> correct_rgba = rgba[:]\n" ">>> correct_rgba[-1] = \"Alpha\"\n" ">>> correct_rgba\n" "[\"Red\", \"Green\", \"Blue\", \"Alpha\"]\n" ">>> rgba\n" "[\"Red\", \"Green\", \"Blue\", \"Alph\"]" msgstr "" ">>> correct_rgba = rgba[:]\n" ">>> correct_rgba[-1] = \"Alpha\"\n" ">>> correct_rgba\n" "[\"Red\", \"Green\", \"Blue\", \"Alpha\"]\n" ">>> rgba\n" "[\"Red\", \"Green\", \"Blue\", \"Alph\"]" #: ../../tutorial/introduction.rst:454 msgid "" "Assignment to slices is also possible, and this can even change the size of " "the list or clear it entirely::" msgstr "" "Zuweisungen an Slices sind ebenfalls möglich, und dies kann sogar die Größe " "der Liste verändern oder sie vollständig leeren::" #: ../../tutorial/introduction.rst:457 msgid "" ">>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" ">>> letters\n" "['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" ">>> # replace some values\n" ">>> letters[2:5] = ['C', 'D', 'E']\n" ">>> letters\n" "['a', 'b', 'C', 'D', 'E', 'f', 'g']\n" ">>> # now remove them\n" ">>> letters[2:5] = []\n" ">>> letters\n" "['a', 'b', 'f', 'g']\n" ">>> # clear the list by replacing all the elements with an empty list\n" ">>> letters[:] = []\n" ">>> letters\n" "[]" msgstr "" ">>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" ">>> letters\n" "['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" ">>> # Ersetze einige Werte\n" ">>> letters[2:5] = ['C', 'D', 'E']\n" ">>> letters\n" "['a', 'b', 'C', 'D', 'E', 'f', 'g']\n" ">>> # Entferne sie jetzt\n" ">>> letters[2:5] = []\n" ">>> letters\n" "['a', 'b', 'f', 'g']\n" ">>> # Leere die Liste, indem alle Elemente durch eine leere Liste ersetzt " "werden\n" ">>> letters[:] = []\n" ">>> letters\n" "[]" #: ../../tutorial/introduction.rst:473 msgid "The built-in function :func:`len` also applies to lists::" msgstr "" "Die integrierte Funktion :func:`len` lässt sich auch auf Listen anwenden::" #: ../../tutorial/introduction.rst:475 msgid "" ">>> letters = ['a', 'b', 'c', 'd']\n" ">>> len(letters)\n" "4" msgstr "" ">>> letters = ['a', 'b', 'c', 'd']\n" ">>> len(letters)\n" "4" #: ../../tutorial/introduction.rst:479 msgid "" "It is possible to nest lists (create lists containing other lists), for " "example::" msgstr "" "Es ist möglich, Listen zu verschachteln (Listen zu erstellen, die andere " "Listen enthalten), zum Beispiel::" #: ../../tutorial/introduction.rst:482 msgid "" ">>> a = ['a', 'b', 'c']\n" ">>> n = [1, 2, 3]\n" ">>> x = [a, n]\n" ">>> x\n" "[['a', 'b', 'c'], [1, 2, 3]]\n" ">>> x[0]\n" "['a', 'b', 'c']\n" ">>> x[0][1]\n" "'b'" msgstr "" ">>> a = ['a', 'b', 'c']\n" ">>> n = [1, 2, 3]\n" ">>> x = [a, n]\n" ">>> x\n" "[['a', 'b', 'c'], [1, 2, 3]]\n" ">>> x[0]\n" "['a', 'b', 'c']\n" ">>> x[0][1]\n" "'b'" #: ../../tutorial/introduction.rst:495 msgid "First Steps Towards Programming" msgstr "Erste Schritte in Richtung Programmierung" #: ../../tutorial/introduction.rst:497 msgid "" "Of course, we can use Python for more complicated tasks than adding two and " "two together. For instance, we can write an initial sub-sequence of the " "`Fibonacci series `_ as " "follows::" msgstr "" "Natürlich können wir Python für kompliziertere Aufgaben nutzen als zwei und " "zwei zusammenzuzählen. Zum Beispiel können wir eine anfängliche Teilfolge " "der `Fibonacci-Folge `_ " "wie folgt schreiben::" #: ../../tutorial/introduction.rst:502 msgid "" ">>> # Fibonacci series:\n" ">>> # the sum of two elements defines the next\n" ">>> a, b = 0, 1\n" ">>> while a < 10:\n" "... print(a)\n" "... a, b = b, a+b\n" "...\n" "0\n" "1\n" "1\n" "2\n" "3\n" "5\n" "8" msgstr "" ">>> # Fibonacci-Folge:\n" ">>> # Die Summe zweier Elemente ergibt das nächste\n" ">>> a, b = 0, 1\n" ">>> while a < 10:\n" "... print(a)\n" "... a, b = b, a+b\n" "...\n" "0\n" "1\n" "1\n" "2\n" "3\n" "5\n" "8" #: ../../tutorial/introduction.rst:517 msgid "This example introduces several new features." msgstr "Dieses Beispiel führt einige neue Funktionen ein." #: ../../tutorial/introduction.rst:519 msgid "" "The first line contains a *multiple assignment*: the variables ``a`` and " "``b`` simultaneously get the new values 0 and 1. On the last line this is " "used again, demonstrating that the expressions on the right-hand side are " "all evaluated first before any of the assignments take place. The right-" "hand side expressions are evaluated from the left to the right." msgstr "" "Die erste Zeile enthält eine *Mehrfachzuweisung*: Die Variablen ``a`` und " "``b`` erhalten gleichzeitig die neuen Werte 0 und 1. In der letzten Zeile " "wird dies erneut verwendet, was zeigt, dass die Ausdrücke auf der rechten " "Seite alle zuerst ausgewertet werden, bevor irgendeine Zuweisung " "stattfindet. Die Ausdrücke auf der rechten Seite werden von links nach " "rechts ausgewertet." #: ../../tutorial/introduction.rst:525 msgid "" "The :keyword:`while` loop executes as long as the condition (here: ``a < " "10``) remains true. In Python, like in C, any non-zero integer value is " "true; zero is false. The condition may also be a string or list value, in " "fact any sequence; anything with a non-zero length is true, empty sequences " "are false. The test used in the example is a simple comparison. The " "standard comparison operators are written the same as in C: ``<`` (less " "than), ``>`` (greater than), ``==`` (equal to), ``<=`` (less than or equal " "to), ``>=`` (greater than or equal to) and ``!=`` (not equal to)." msgstr "" "Die :keyword:`while`-Schleife wird ausgeführt, solange die Bedingung (hier: " "``a < 10``) wahr bleibt. In Python ist, wie in C, jeder Ganzzahlwert " "ungleich Null wahr; Null ist falsch. Die Bedingung kann auch ein String- " "oder Listenwert sein, tatsächlich jede Sequenz, alles mit einer Länge " "ungleich Null ist wahr, leere Sequenzen sind falsch. Der im Beispiel " "verwendete Test ist ein einfacher Vergleich. Die Standard-" "Vergleichsoperatoren werden genauso geschrieben wie in C: ``<`` (kleiner " "als), ``>`` (größer als), ``==`` (gleich), ``<=`` (kleiner oder gleich), " "``>=`` (größer oder gleich) und ``!=`` (ungleich)." #: ../../tutorial/introduction.rst:534 msgid "" "The *body* of the loop is *indented*: indentation is Python's way of " "grouping statements. At the interactive prompt, you have to type a tab or " "space(s) for each indented line. In practice you will prepare more " "complicated input for Python with a text editor; all decent text editors " "have an auto-indent facility. When a compound statement is entered " "interactively, it must be followed by a blank line to indicate completion " "(since the parser cannot guess when you have typed the last line). Note " "that each line within a basic block must be indented by the same amount." msgstr "" "Der *Rumpf* der Schleife ist *eingerückt*: Einrückung ist Pythons Methode, " "um Anweisungen zu gruppieren. An der interaktiven Eingabeaufforderung musst " "du für jede eingerückte Zeile einen Tabulator oder Leerzeichen eingeben. In " "der Praxis wirst du kompliziertere Eingaben für Python mit einem Texteditor " "vorbereiten; alle guten Texteditoren verfügen über eine automatische " "Einrückung. Wenn eine zusammengesetzte Anweisung interaktiv eingegeben wird, " "muss ihr eine Leerzeile folgen, um den Abschluss anzuzeigen (da der Parser " "nicht erraten kann, wann du die letzte Zeile eingegeben hast). Beachte, dass " "jede Zeile innerhalb eines Basisblocks um denselben Abstand eingerückt sein " "muss." #: ../../tutorial/introduction.rst:543 msgid "" "The :func:`print` function writes the value of the argument(s) it is given. " "It differs from just writing the expression you want to write (as we did " "earlier in the calculator examples) in the way it handles multiple " "arguments, floating-point quantities, and strings. Strings are printed " "without quotes, and a space is inserted between items, so you can format " "things nicely, like this::" msgstr "" "Die Funktion :func:`print` gibt den Wert des oder der übergebenen Argumente " "aus. Sie unterscheidet sich vom bloßen Schreiben des Ausdrucks (wie wir es " "vorhin in den Rechnerbeispielen getan haben) durch die Art und Weise, wie " "sie mit mehreren Argumenten, Gleitkommazahlen und Strings umgeht. Strings " "werden ohne Anführungszeichen ausgegeben, und zwischen den Elementen wird " "ein Leerzeichen eingefügt, sodass du Dinge schön formatieren kannst, wie " "hier::" #: ../../tutorial/introduction.rst:550 msgid "" ">>> i = 256*256\n" ">>> print('The value of i is', i)\n" "The value of i is 65536" msgstr "" ">>> i = 256*256\n" ">>> print('The value of i is', i)\n" "The value of i is 65536" #: ../../tutorial/introduction.rst:554 msgid "" "The keyword argument *end* can be used to avoid the newline after the " "output, or end the output with a different string::" msgstr "" "Das Schlüsselwort-Argument *end* kann verwendet werden, um den Zeilenumbruch " "nach der Ausgabe zu verhindern oder die Ausgabe mit einer anderen " "Zeichenkette zu beenden::" #: ../../tutorial/introduction.rst:557 msgid "" ">>> a, b = 0, 1\n" ">>> while a < 1000:\n" "... print(a, end=',')\n" "... a, b = b, a+b\n" "...\n" "0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987," msgstr "" ">>> a, b = 0, 1\n" ">>> while a < 1000:\n" "... print(a, end=',')\n" "... a, b = b, a+b\n" "...\n" "0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987," #: ../../tutorial/introduction.rst:566 msgid "Footnotes" msgstr "Fußnoten" #: ../../tutorial/introduction.rst:567 msgid "" "Since ``**`` has higher precedence than ``-``, ``-3**2`` will be interpreted " "as ``-(3**2)`` and thus result in ``-9``. To avoid this and get ``9``, you " "can use ``(-3)**2``." msgstr "" "Da ``**`` eine höhere Rangfolge als ``-`` hat, wird ``-3**2`` als ``-" "(3**2)`` interpretiert und führt somit zu ``-9``. Um dies zu vermeiden und " "``9`` zu erhalten, kannst du ``(-3)**2`` verwenden." #: ../../tutorial/introduction.rst:571 msgid "" "Unlike other languages, special characters such as ``\\n`` have the same " "meaning with both single (``'...'``) and double (``\"...\"``) quotes. The " "only difference between the two is that within single quotes you don't need " "to escape ``\"`` (but you have to escape ``\\'``) and vice versa." msgstr "" "Anders als in anderen Sprachen haben Sonderzeichen wie ``\\n`` sowohl bei " "einfachen (``'...'``) als auch bei doppelten (``\"...\"``) Anführungszeichen " "dieselbe Bedeutung. Der einzige Unterschied besteht darin, dass du innerhalb " "einfacher Anführungszeichen ``\"`` nicht maskieren musst (dafür aber " "``\\'``) und umgekehrt." #: ../../tutorial/introduction.rst:20 msgid "# (hash)" msgstr "Hash" #: ../../tutorial/introduction.rst:20 msgid "comment" msgstr "Kommentar" #~ msgid "" #~ "The interpreter acts as a simple calculator: you can type an expression " #~ "at it and it will write the value. Expression syntax is straightforward: " #~ "the operators ``+``, ``-``, ``*`` and ``/`` can be used to perform " #~ "arithmetic; parentheses (``()``) can be used for grouping. For example::" #~ msgstr "" #~ "Der Interpreter funktioniert wie ein einfacher Taschenrechner: Du kannst " #~ "einen Ausdruck eingeben und er gibt den Wert aus. Die Syntax für " #~ "Ausdrücke ist einfach und intuitiv: Die Operatoren ``+``, ``-``, ``*`` " #~ "und ``/`` können für arithmetische Berechnungen verwendet werden; " #~ "Klammern (``()``) dienen der Gruppierung. Zum Beispiel::" #~ msgid "" #~ ">>> print('C:\\some\\name') # here \\n means newline!\n" #~ "C:\\some\n" #~ "ame\n" #~ ">>> print(r'C:\\some\\name') # note the r before the quote\n" #~ "C:\\some\\name" #~ msgstr "" #~ ">>> print('C:\\some\\name') # hier steht \\n für Zeilenumbruch!\n" #~ "C:\\some\n" #~ "ame\n" #~ ">>> print(r'C:\\some\\name') # beachte das r vor dem Anführungszeichen\n" #~ "C:\\some\\name"