Python Forum
Self re-initializing variable?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Self re-initializing variable?
#6
(May-03-2019, 02:38 PM)Gribouillis Wrote:
Quote:If there another way to create a list of tuples beside zip()?
There are many ways. One of them is list comprehension
>>> [(i, i+1, i+2) for i in range(5)]
[(0, 1, 2), (1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 6)]

Very concise method for creating list of values.
And if I need to combine already pre-existing values from one list/tuples to another list of tuples?
Thanks.
Reply


Messages In This Thread
Self re-initializing variable? - by python_user_n - May-03-2019, 02:16 PM
RE: Self re-initializing variable? - by ichabod801 - May-03-2019, 02:27 PM
RE: Self re-initializing variable? - by Gribouillis - May-03-2019, 02:32 PM
RE: Self re-initializing variable? - by Gribouillis - May-03-2019, 02:38 PM
RE: Self re-initializing variable? - by python_user_n - May-03-2019, 02:44 PM
RE: Self re-initializing variable? - by Gribouillis - May-03-2019, 02:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Auto-py-to-exe Stuck At 'Initializing' killingtime 5 7,568 Jan-21-2024, 10:52 PM
Last Post: ShiDari
  "unexpected keyword arg" when initializing my subclasses Phaze90 3 3,568 Nov-25-2022, 07:39 PM
Last Post: Gribouillis
  Initializing a PRINTDLG structure-how to hammer 4 1,666 Jun-08-2022, 07:07 PM
Last Post: jefsummers
  Syntax when initializing empty lists Mark17 2 1,520 Jun-02-2022, 04:09 PM
Last Post: Mark17
  Initializing, reading and updating a large JSON file medatib531 0 1,918 Mar-10-2022, 07:58 PM
Last Post: medatib531

Forum Jump:

User Panel Messages

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