SubhanUllah Posted September 16, 2022 Report Share Posted September 16, 2022 l=[1,2,3,4,5,2,3,4,7,9,5] # janky list with open(filename) as file: l = file.readlines() l= [l.rstrip() for line in lines] # only if you want strip out wihtespaces l1=[] # final list without dupes for i in l: if i not in l1: l1.append(i) else: print(i,end=' ') Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.