Python Forum
Can I use a sublist as an argument in python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I use a sublist as an argument in python?
#2
you need to do it like:
city = [['house', 'street', 'park'], ['car', 'bike', 'train']]

def sublist(element):
   print(element)

part = 0
sublist(city[part])
results:
Output:
['house', 'street', 'park']
Reply


Messages In This Thread
RE: Can I use a sublist as an argument in python? - by Larz60+ - Aug-25-2018, 10:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Sublist/ Subarray into string Python SantiagoPB 2 2,208 Apr-23-2021, 07:03 PM
Last Post: SantiagoPB
  SyntaxError: positional argument follows keyword argument syd_jat 3 5,979 Mar-03-2020, 08:34 AM
Last Post: buran
  List of objects with sublist medatib531 4 2,431 Mar-01-2020, 06:16 PM
Last Post: buran
  Insert into sublist if sublist is not having same no of records. parthi1705 10 4,658 May-28-2019, 12:01 PM
Last Post: perfringo
  Split List and Sublist from Pyodbc parthi1705 1 2,281 May-05-2019, 10:44 AM
Last Post: Larz60+
  merging sublist into single list in python abhishek8singhai 8 9,736 Mar-22-2019, 11:46 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

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