Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Stefan Schwarzer Newsgroups: de.comp.lang.python Subject: Re: [Python-de] Verstaendnisproblem Date: Fri, 12 Feb 2021 16:07:48 +0100 Lines: 41 Message-ID: References: <2763401.e9J7NaK4W3@host.fritz.box> <107543700.nniJfEyVGO@host.fritz.box> <5436893.DvuYhMxLoT@host.fritz.box> <8c5a698d-6083-1244-f205-c843af42ef02@sschwarzer.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de J03gP0eXx7f7hU9OOGtcGAd3Mp28flxssU0FmW2CHp+w== Return-Path: X-Original-To: python-de@python.org Delivered-To: python-de@mail.python.org Authentication-Results: mail.python.org; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy); dkim-atps=neutral User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.24) Gecko/20100411 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 In-Reply-To: <5436893.DvuYhMxLoT@host.fritz.box> Content-Language: de-DE X-Provags-ID: V03:K1:zUOBDk/gKF0aLviNm81qbTo/5gF8/4v5C3z0GB4wm9qaZu3iNGN mJYZp1n+GGWxlQe8kBjw6qxjAY5evIymD+xjYwD9wa7+nqO1qVA7eW7vrrY0HYcjB3Y2CZ4 3LLhkMFDWItSfK1PppY89rlz+1+tWzXLk+TgR17B04eZtjYirD4PD4pAfR5KYuIEyy61Ale QhqAix61yh9NvLOhcIGDw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:WfQKTMF+MBQ=:QdOA1CakJot115Mn8i//QW 3/FO4wLjGuoaH08XeAS8zh0fnsSDTC5nlqocY0zB+KlfBXXfz4NiDx9BO+osVk3jjM8hAvgBO /dTMFFeSSHuER6pAVDFaZxz1Kh3wHKLQc6HYFS9wB75kNurX3WiGZtUYOK5h6TrS4eAUVWy76 6IJ2AsDjEHBMZeLCSv43UCFMUbxdjCQRKMn6VJ5FLV+Ucru61dk0s89zfqP5u1/wYIU3OtNMS TOeKhqFNmjFd2GGa1KHkotJXpIBuuAPyUMnbvySG7IErcWd3rdF9Bg8gYRMBBRHGAjqIsHW82 z4wlk4V/0nyBBfzWUF8GddJPYu1ASxYisoaZFgWU3gylrXYa+L4NXMQmojVjonqzc3/ZtHBeg 9gaPOYHQ36jjww4YPiCnFt51xVKj4W0sOeWkCPZ3mKRnq17NSlioTQqfAirvxRKBYE6LAvc/1 SNoyLcSZtA== X-BeenThere: python-de@python.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Die Deutsche Python Mailingliste List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <8c5a698d-6083-1244-f205-c843af42ef02@sschwarzer.net> X-Mailman-Original-References: <2763401.e9J7NaK4W3@host.fritz.box> <107543700.nniJfEyVGO@host.fritz.box> <5436893.DvuYhMxLoT@host.fritz.box> Xref: csiph.com de.comp.lang.python:5711 On 2021-02-12 15:29, eilfh wrote: > Am Donnerstag, 11. Februar 2021, 18:48:23 CET schrieb Peter Otten: > Hallo, Peter > > danke für Deine Antwort. > > Das war das fehlende Puzzle in meinem Programm > >> >>> x >> >> 0 4 >> Name: B, dtype: int64 >> >> >>> type(x) >> >> >> >> >> kannst Du einfach entpacken >> >> >>> [y] = x >> >>> y >> >> 4 > > > um ehrlich zu sein, ich versteh's zwar nicht, > aber es läuft und erfüllte genau den Zweck Falls du `[y] = x` meinst, kann ich mir vorstellen, dass das komisch aussieht. Das ist sogenanntes implizites "Tuple unpacking", hier vielleicht eher "List unpacking". Du kannst das auch als `y = x[0]` schreiben; ich denke, das ist klarer. Die Schreibweise `[y] = x` hat allerdings wiederum den Vorteil, dass du eine Exception bekommst, wenn `x` mehr als ein zu "entpackendes" Element enthält, obwohl du das in deinem Code nicht erwartest. Viele Grüße Stefan