Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5529
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Hermann Riemann <nospam.ng@hermann-riemann.de> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: python2 --> python3 : str vs bytes |
| Date | Sun, 25 Aug 2019 10:20:16 +0200 |
| Lines | 27 |
| Message-ID | <gseum0F4hcoU1@mid.individual.net> (permalink) |
| References | <qjtf7q$p8s$1@news2.informatik.uni-stuttgart.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net u1rqsHw5mXv2wqcvTYvm8A0b0mwyexAUA08T3zhvQe0Kixlcpm |
| Cancel-Lock | sha1:+SgesNJsfAN/j50y8JtwBuddunU= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
| In-Reply-To | <qjtf7q$p8s$1@news2.informatik.uni-stuttgart.de> |
| Content-Language | de-DE |
| Xref | csiph.com de.comp.lang.python:5529 |
Show key headers only | View raw
Am 25.08.19 um 10:00 schrieb Ulli Horlacher:
> Die entsprechende Funktion sieht so aus:
> def despace(s):
> return ' '.join(s.split())
> Das soll (White-)Spaces am Anfang und Ende eines Strings entfernen und aus
> Multi-Spaces einen einzelnen machen.
> Mit Python 2 funktioniert das auch.
> Wieso liefert string.split() bytes zurueck und nicht wieder str?
Weil vermutlich string vorher vom type bytes war.
> Wie macht mans besser?
Mit print(type(s)) an einigen Stellen nachschauen
warum s nicht vom Typ str ( Buchstaben in utf ) ist
Hermann
vermutend, das iso utf Probleme noch Jahrzehnte
erhalten bleiben.
--
http://www.hermann-riemann.de
Back to de.comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
python2 --> python3 : str vs bytes Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2019-08-25 08:00 +0000
Re: python2 --> python3 : str vs bytes Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-08-25 10:20 +0200
Re: [Python-de] python2 --> python3 : str vs bytes Stefan Behnel <python-de@behnel.de> - 2019-08-25 10:44 +0200
Re: [Python-de] python2 --> python3 : str vs bytes Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-08-26 07:03 +0200
csiph-web