Files
SerialVisualizer/tescik.py
2022-07-12 07:25:44 +02:00

25 lines
423 B
Python

# x = {1: 20, 3: 40, 4: 30, 2: 10, 0: 0}
# list_of_tuple = sorted(x.items(), key=lambda item: item[0])
# print([ v for k, v in list_of_tuple])
# print( { k: v for k, v in sorted(x.items(), key=lambda item: item[0])} )
l = [5, 8, 2, 4, 1, 10, None]
class test:
def __init__(self, l) -> None:
self.l = l
def print(self):
print(l)
t = test(l)
l.sort(key=lambda x: (x is None, x))
t.print()