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,066 Jul-29-2021, 04:27 PM
Last Post: yovel
  Help needed for a python package keysson 1 2,296 Sep-02-2020, 03:37 AM
Last Post: Larz60+
  I need advise with developing a brute forcing script fatjuicypython 11 5,283 Aug-21-2020, 09:20 PM
Last Post: Marbelous
Smile Help needed. Python Newbie!, it will be fun. knightdea 3 2,695 Oct-13-2019, 08:50 AM
Last Post: perfringo
  Please, advise collections for my task AlekseyPython 1 2,152 Sep-11-2019, 12:44 PM
Last Post: perfringo
  help needed with python launcher fallenlight 3 3,430 Jan-19-2019, 01:06 PM
Last Post: snippsat
  Basic Help Needed JohnV 2 2,462 Jan-09-2019, 09:43 PM
Last Post: buran
  Very basic programming help needed: pig latin program bstocks 2 8,058 Dec-02-2017, 08:12 AM
Last Post: RickyWilson
  General advise for building a video manager ffrree 1 2,822 Oct-25-2017, 01:24 AM
Last Post: Larz60+
  Libraries needed for python install? burvil 7 20,304 Oct-18-2017, 04:55 AM
Last Post: burvil

Forum Jump:

User Panel Messages

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