Python Forum
Help removing asterisk item in a nested list.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help removing asterisk item in a nested list.
#4
(Apr-06-2020, 12:42 PM)bmcguire Wrote: Here is my final code that producing a list without the asterisks.
Thanks for showing the solution that worked for you.
To show another way.
>>> [[e.strip('*') for e in element] for element in nvlanlist]
[['VLAN_2344', 'ae0.0'],
 ['VLAN_2344', 'ae1.0'],
 ['VLAN_2344', 'ge-0/0/1.0'],
 ['VLAN_2344', 'ge-0/0/10.0'],
 ['VLAN_2344', 'ge-0/0/11.0'],
 ['VLAN_2344', 'ge-0/0/12.0'],
 ['VLAN_2344', 'ge-0/0/13.0']]
Reply


Messages In This Thread
RE: Help removing asterisk item in a nested list. - by snippsat - Apr-06-2020, 02:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List all possibilities of a nested-list by flattened lists sparkt 1 930 Feb-23-2023, 02:21 PM
Last Post: sparkt
  Whys is asterisk and random variable necessary in these functions? rrowhe4d 5 1,531 Aug-05-2022, 07:53 AM
Last Post: Gribouillis
Question Finding string in list item jesse68 8 1,902 Jun-30-2022, 08:27 AM
Last Post: Gribouillis
  Updating nested dict list keys tbaror 2 1,295 Feb-09-2022, 09:37 AM
Last Post: tbaror
  Python Program to Find the Total Sum of a Nested List vlearner 8 4,947 Jan-23-2022, 07:20 PM
Last Post: menator01
  how to easily create a list of already existing item CompleteNewb 15 3,590 Jan-06-2022, 12:48 AM
Last Post: CompleteNewb
  Remove an item from a list contained in another item in python CompleteNewb 19 5,797 Nov-11-2021, 06:43 AM
Last Post: Gribouillis
  Looping through nested elements and updating the original list Alex_James 3 2,147 Aug-19-2021, 12:05 PM
Last Post: Alex_James
  count item in list korenron 8 3,503 Aug-18-2021, 06:40 AM
Last Post: naughtyCat
  Time.sleep: stop appending item to the list if time is early quest 0 1,885 Apr-13-2021, 11:44 AM
Last Post: quest

Forum Jump:

User Panel Messages

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