Python Forum
Absolutely new to python - basic advise needed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Absolutely new to python - basic advise needed
#3
To add to buran's reply

Wording taken direct from the python docs Wrote:
d = 1, 2, 3
The statement t = 12345, 54321, 'hello!' is an example of tuple packing: the values 12345, 54321 and 'hello!' are packed together in a tuple.
The reverse operation is also possible:

x, y, z = t
This is called, appropriately enough, sequence unpacking and works for any sequence on the right-hand side. Sequence unpacking requires that there are as many variables on the left side of the equals sign as there are elements in the sequence. Note that multiple assignments are really just a combination of tuple packing and sequence unpacking.
Reply


Messages In This Thread
RE: Absolutely new to python - basic advise needed - by Yoriz - Jun-12-2020, 08:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python issue - Data science - Help is needed yovel 2 2,023 Jul-29-2021, 04:27 PM
Last Post: yovel
  Basic python Natters10 3 3,102 Nov-29-2020, 07:04 AM
Last Post: Love2code
  Help needed for a python package keysson 1 2,229 Sep-02-2020, 03:37 AM
Last Post: Larz60+
  I need advise with developing a brute forcing script fatjuicypython 11 5,088 Aug-21-2020, 09:20 PM
Last Post: Marbelous
  Help with basic python AaronG123 4 2,271 Nov-14-2019, 02:57 PM
Last Post: AaronG123
Smile Help needed. Python Newbie!, it will be fun. knightdea 3 2,641 Oct-13-2019, 08:50 AM
Last Post: perfringo
  Please, advise collections for my task AlekseyPython 1 2,111 Sep-11-2019, 12:44 PM
Last Post: perfringo
  help needed with python launcher fallenlight 3 3,385 Jan-19-2019, 01:06 PM
Last Post: snippsat
  Basic Help Needed JohnV 2 2,410 Jan-09-2019, 09:43 PM
Last Post: buran
  Very basic programming help needed: pig latin program bstocks 2 8,006 Dec-02-2017, 08:12 AM
Last Post: RickyWilson

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020