PyTricks icon indicating copy to clipboard operation
PyTricks copied to clipboard

Collection of less popular features and tricks for the Python programming language

Results 12 PyTricks issues
Sort by recently updated
recently updated
newest added

By using the print function and the StringIO object.

added deque data structures, python has some efficient data structures inbuilt

# Traditional way if a > 7: b = '>7' elif a == 7: b = '7' else: b = '7' if a > 7 else '7' if a ==...

# traditional way ''' Printing the pattern * ** *** **** ''' for i in range(1,4+1): for j in range(i): print('*', end='') print() # hack `print('\n'.join(['*' * i for i...

grouping adjacent use zip and iter... some code like this: ``` python lst = range(10) group_n = lambda lst, n: zip(*([iter(lst)] * n)) print group(lst, 3) #output #[(0, 1, 2),...