Python: Simple Method example for deleting the same element in the list, python example
This example describes how to delete the same elements in the list in Python. We will share this with you for your reference. The details are as follows:
Removing repeated elements in the list is very simple and you can directly use the code:
A = [11, 21, 3, 4, 3, 2, 5] B = list (set (a) print (B)
Running result:
E: \ Program \ Python> d. py [11, 21, 3, 4, 3, 2, 5] [2, 3, 4, 5, 11, 21]
Have you seen it? The result does not contain repeated elements. However, at the same time, the elements in the results are sorted in ascending order!
PS: Here are several repeated tools for your reference:
Online deduplication tools:
Http://tools.jb51.net/code/quchong
Online text deduplication tool:
Http://tools.jb51.net/aideddesign/txt_quchong
For more Python-related content, refer to this topic: Python list) operation Skills summary, Python coding skills summary, Python data structure and algorithm tutorial, Python function usage skills summary, Python string operation skills summary, Python basic and advanced tutorial and Python file and directory operation tips
I hope this article will help you with Python programming.