100 Python Tips & Tricks - HolyPython.com
holypython.com › 100-python-tips-tricksprint(type(a)) <class 'set'>. If you want to overcome the type conversion and keep your data as a list just add a list function as below and it will stay as a list after set function removes all the duplicates: lst= [1,2,2,2,2,3,4,4,5,6,7] a=list(set(lst)) print(a) print(type(a)) {1,2,3,4,5,6,7} <class 'list'>.