×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Python
Posted by: Matthew J_
Added: Jun 22, 2022 1:16 PM
Modified: Jun 22, 2022 1:27 PM
Views: 0
  1. #remove a sublist from a list-use remove method
  2.  
  3. list1 = [10,20,30,40,50,60]
  4. sublist2 = [30,40,50]
  5.  
  6. for i in sublist2:
  7.   list1.remove(i)
  8.  
  9. print(list1)            # [10, 20, 60]