Python Forum
user input for multi-dimentional list without a prior iteration using input()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
user input for multi-dimentional list without a prior iteration using input()
#2
what you have is a double cast, which is the same as a single cast.
that's like saying red, red is the barn colour
and thus both will give you a single dimension list

example:
>>> l = list(list(input().split()))
1 2 3 4 5
>>> l
['1', '2', '3', '4', '5']
>>> l = list(input().split())
1 2 3 4 5
>>> l
['1', '2', '3', '4', '5']
Reply


Messages In This Thread
RE: user input for multi-dimentional list without a prior iteration using input() - by Larz60+ - Sep-21-2020, 08:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Waiting for input from serial port, then move on KenHorse 3 1,157 Apr-17-2024, 07:21 AM
Last Post: DeaD_EyE
  Help with to check an Input list data with a data read from an external source sacharyya 3 446 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  difference between forms of input a list to function akbarza 6 1,102 Feb-21-2024, 08:02 PM
Last Post: bterwijn
  pyaudio seems to randomly halt input. elpidiovaldez5 2 419 Jan-22-2024, 09:07 AM
Last Post: elpidiovaldez5
  Receive Input on Same Line? johnywhy 8 770 Jan-16-2024, 03:45 AM
Last Post: johnywhy
  manually input data jpatierno 0 362 Nov-10-2023, 02:32 AM
Last Post: jpatierno
  Using string input for boolean tronic72 3 735 Nov-01-2023, 07:48 AM
Last Post: Gribouillis
  problem in using input command akbarza 4 1,195 Oct-19-2023, 03:27 PM
Last Post: popejose
  problem in entering address of a file in input akbarza 0 675 Oct-18-2023, 08:16 AM
Last Post: akbarza
  Input network device connection info from data file edroche3rd 6 1,099 Oct-12-2023, 02:18 AM
Last Post: edroche3rd

Forum Jump:

User Panel Messages

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