
Hallo, vielen Dank für die schnellen Antworten. Diese Behandlung der Strings, hatte ich nicht berücksichtig. Nochmals vielen Dank allen die geantwortet haben. Mit freundlichen Grüßen / Kind regards Frank Wagner Entwicklung - Prozesstransmitter WIKA Alexander Wiegand SE & Co. KG Alexander Wiegand-Straße 30 63911 Klingenberg am Main Tel: 09372-132-8995 Fax: 09372-132-9976 E-mail: f.wagner@wika.de -----Ursprüngliche Nachricht----- Von: python-de-bounces+f.wagner=wika.de@python.org [mailto:python-de-bounces+f.wagner=wika.de@python.org] Im Auftrag von Florian Diesch Gesendet: Freitag, 1. Juli 2011 11:37 An: Die Deutsche Python Mailingliste Betreff: Re: [Python-de] Zeichen in einem String ersetzen Am Freitag, den 01.07.2011, 10:01 +0200 schrieb "Wagner, Frank" <F.Wagner@wika.de>:
ich möchte in einem String den Dezimalpunkt durch ein Komma ersetzen, leider hat folgender Code keinen Effekt:
anzahl = len(werteliste)
for i in range(anzahl-1):
werteliste[i].replace(".", ",", 1) # Punkt durch Komma ersetzen zur
Sehe ich mir das im Debugger an so sehen die einzelnen Listenelemente wie folgt aus:
werteliste[i] '+3.00305873E+00'
Wenn ich darüber steppe bleibt der Punkt allerdings erhalten.
Ich hab keine Ahnung was ich übersehen habe aber vielleicht kann mir einer auf die Sprünge helfen.
Strings sind in Python unveränderbar. replace() verändert daher nicht den String, sondern gibt einen neuen String zurück. Nimm daher werteliste[i] = werteliste[i].replace(".", ",", 1) -- <http://www.florian-diesch.de> <http://identi.ca/diesch/> _______________________________________________ python-de maillist - python-de@python.org http://mail.python.org/mailman/listinfo/python-de -- Bevor Sie diese E-Mail ausdrucken, überlegen Sie bitte, ob dies wirklich erforderlich ist. Please think before you print. -- WIKA Alexander Wiegand SE & Co. KG Alexander-Wiegand-Straße 30 - 63911 Klingenberg - Germany Kommanditgesellschaft: Sitz Klingenberg - Amtsgericht Aschaffenburg HRA 1819 Komplementärin: WIKA Verwaltungs SE & Co. KG - Sitz Klingenberg - Amtsgericht Aschaffenburg HRA 4685 Komplementärin: WIKA International SE - Sitz Klingenberg - Amtsgericht Aschaffenburg HRB 10505 Vorstand: Alexander Wiegand Vorsitzender des Aufsichtsrats: Dr. Max Egli Telefon: (09372) 132-0 Internet: www.wika.com -- The information contained in this E-Mail and any attached files are strictly confidential and may be subject to legal privilege. If you are not the intended recipient, his representative or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error and that any dissemination, copying or use of this message or attachment is strictly forbidden, as is the disclosure of the information therein. If you have received this E-Mail in error, please notify us immediately by E-Mail or telephone and delete this message and all its attachments subsequently. All reasonable precautions have been taken to ensure no viruses are present in this E-Mail.