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?

jingweimo
  • 4,472
  • 8
  • 41
  • 69

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.

jingweimo
  • 4,472
  • 8
  • 41
  • 69