Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #4623

Re: [Python-de] Wie sieht Python fuer mich aus?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups de.comp.lang.python
Subject Re: [Python-de] Wie sieht Python fuer mich aus?
Date Mon, 09 Jan 2017 13:45:15 +0100
Organization None
Lines 26
Message-ID <mailman.380.1483966894.2395.python-de@python.org> (permalink)
References <Python-20170108184230@ram.dialup.fu-berlin.de> <o500kn$k4$1@blaine.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace news.uni-berlin.de L6pWusUYStolGmP4jeB2HgtNJLYPL1E2f9KauwPONJwQ==
Return-Path <gcpgg-python-de@m.gmane.org>
X-Original-To python-de@python.org
Delivered-To python-de@mail.python.org
X-Injected-Via-Gmane http://gmane.org/
User-Agent KNode/4.13.3
X-BeenThere python-de@python.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Die Deutsche Python Mailingliste <python-de.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-de/>
List-Post <mailto:python-de@python.org>
List-Help <mailto:python-de-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <o500kn$k4$1@blaine.gmane.org>
X-Mailman-Original-References <Python-20170108184230@ram.dialup.fu-berlin.de>
Xref csiph.com de.comp.lang.python:4623

Show key headers only | View raw


Stefan Ram wrote:

> Ausgeben
> 
> »print« rundet Zahlen bei der Ausgabe etwas, während die
> Konsole alle Nachkommastellen anzeigt.

Genauer, der Unterschied besteht zwischen repr(x) und str(x), und nur in 
Python 2:

$ python2 -c 'x = 1./3; print repr(x) == str(x)'
False
$ python3 -c 'x = 1./3; print(repr(x) == str(x))'
True

Wenn du gerade erst startest und keine Python-2-Programme "geerbt" hast, 
gibt's eigentlich keinen Grund, Python 2 zu verwenden.

> Einlesen
> 
> »input(prompt)« liefert einen String, der dann mit »float«
> in eine Zahl gewandelt werden kann.
 
In Python 3; in Python 2 heißt die Funktion raw_input(). 

Back to de.comp.lang.python | Previous | Next | Find similar


Thread

Re: [Python-de] Wie sieht Python fuer mich aus? Peter Otten <__peter__@web.de> - 2017-01-09 13:45 +0100

csiph-web