0

Assume a list:

A = ['a','a','a','b','b','c','c','c']

I want to convert A to B:

B = ['a','b','c']

Is there an efficient way to do that?

jwm
  • 4,832
  • 10
  • 46
  • 78

1 Answers1

1

I got it by using set function:

B = list(set(A))

But this function may change the order in which the unique items are arranged in the sequence.

jwm
  • 4,832
  • 10
  • 46
  • 78