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
  How to Print a Pyramid Asterisk Pattern in Python? williamclark 0 812 Mar-24-2025, 10:05 AM
Last Post: williamclark
  removing one list element without using its index paul18fr 7 1,099 Feb-22-2025, 07:59 PM
Last Post: DeaD_EyE
  What is a faster way to deep copy a nested list without using .deepcopy()? Shervin_Ataeian 1 1,401 Oct-13-2024, 01:28 PM
Last Post: Pedroski55
  List all possibilities of a nested-list by flattened lists sparkt 1 1,760 Feb-23-2023, 02:21 PM
Last Post: sparkt
  Whys is asterisk and random variable necessary in these functions? rrowhe4d 5 2,549 Aug-05-2022, 07:53 AM
Last Post: Gribouillis
Question Finding string in list item jesse68 8 3,108 Jun-30-2022, 08:27 AM
Last Post: Gribouillis
  Updating nested dict list keys tbaror 2 1,916 Feb-09-2022, 09:37 AM
Last Post: tbaror
  Python Program to Find the Total Sum of a Nested List vlearner 8 7,986 Jan-23-2022, 07:20 PM
Last Post: menator01
  how to easily create a list of already existing item CompleteNewb 15 6,007 Jan-06-2022, 12:48 AM
Last Post: CompleteNewb
  Remove an item from a list contained in another item in python CompleteNewb 19 8,725 Nov-11-2021, 06:43 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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