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


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

Re: [Python-de] Migration Python 2 auf 3

Path csiph.com!news.redatomik.org!fu-berlin.de!uni-berlin.de!not-for-mail
From Hartmut Goebel <h.goebel@crazy-compilers.com>
Newsgroups de.comp.lang.python
Subject Re: [Python-de] Migration Python 2 auf 3
Date Fri, 16 Mar 2018 14:44:24 +0100
Organization crazy-compilers.com
Lines 26
Message-ID <mailman.108.1521208312.1867.python-de@python.org> (permalink)
References <p8ggsi$96i$1@solani.org> <ef92513f-469b-723b-730c-baac911a313a@crazy-compilers.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de FiJ6/2o0Lvw5J2oNtgKWBg9PWKvvLRaJFJhjrOwDMseQ==
Return-Path <h.goebel@crazy-compilers.com>
X-Original-To python-de@python.org
Delivered-To python-de@mail.python.org
X-Virus-Scanned amavisd-new at mnet-online.de
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
In-Reply-To <p8ggsi$96i$1@solani.org>
Content-Language de-DE
X-BeenThere python-de@python.org
X-Mailman-Version 2.1.26
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 <ef92513f-469b-723b-730c-baac911a313a@crazy-compilers.com>
X-Mailman-Original-References <p8ggsi$96i$1@solani.org>
Xref csiph.com de.comp.lang.python:5139

Show key headers only | View raw


Am 16.03.2018 um 14:29 schrieb Philipp Klaus Krause:
> spawn = popen2.Popen4(cmd)
> spawn.wait()
> output = spawn.fromchild.readlines()

Verwende einfach das Modul subprocess. Wie Du von popen2.Popen4 auf
subprocess umstellst sollte unter docs.python.org erklärt sein.
> gibt es auch für print mit Komma am Ende eine Alternative, die sowohl
> mit Python 2 als auch 3 funktioniert?
> […]
> print("%-35.35s" % base, end=' ')
>
> was aber wohl unter Python 2 nicht erlaubt ist.


Das ist ganz einfach: "from __future__ import print_function" als erstes
Statement (ggf. hinter dem Doc-String).


-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

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


Thread

Migration Python 2 auf 3 Philipp Klaus Krause <pkk@spth.de> - 2018-03-16 14:29 +0100
  Re: [Python-de] Migration Python 2 auf 3 Christopher Arndt <chris@chrisarndt.de> - 2018-03-16 14:44 +0100
  Re: [Python-de] Migration Python 2 auf 3 Hartmut Goebel <h.goebel@crazy-compilers.com> - 2018-03-16 14:44 +0100
    Re: [Python-de] Migration Python 2 auf 3 Philipp Klaus Krause <pkk@spth.de> - 2018-03-16 15:32 +0100
  Re: Migration Python 2 auf 3 Philipp Klaus Krause <pkk@spth.de> - 2018-03-16 15:35 +0100
    Re: [Python-de] Migration Python 2 auf 3 Stefan Behnel <python-de@behnel.de> - 2018-03-16 15:46 +0100
    Re: [Python-de] Migration Python 2 auf 3 Christopher Arndt <chris@chrisarndt.de> - 2018-03-16 15:50 +0100
    Re: [Python-de] Migration Python 2 auf 3 Stefan Behnel <python-de@behnel.de> - 2018-03-16 17:05 +0100

csiph-web