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


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

Re: Migration Python 2 auf 3

From Philipp Klaus Krause <pkk@spth.de>
Newsgroups de.comp.lang.python
Subject Re: Migration Python 2 auf 3
Date 2018-03-16 15:35 +0100
Organization solani.org
Message-ID <p8gkmm$bn2$2@solani.org> (permalink)
References <p8ggsi$96i$1@solani.org>

Show all headers | View raw


Der Rat,
from __future__ import print_function
zu verwenden, hat mir schonmal weitergeholfen. Vielen Dank.

Nun hätte ich noch ein

    m = re.match(r'([^/]*)/([^/]*)/([^/]*)/(.*)$', name)
    if (m >= 3):
        base = m.group(3)

das mit Python 2 funktioniert, aber mit Python 3 nicht:

Traceback (most recent call last):
  File "./compact-results.py", line 50, in <module>
    if (m >= 3):
TypeError: '>=' not supported between instances of '_sre.SRE_Match' and
'int'

Philipp

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