how to sort file contents in python code example
Example: python script to sort file content
with open('shopping.txt', 'r') as r:
for line in sorted(r):
print(line, end='')
with open('shopping.txt', 'r') as r:
for line in sorted(r):
print(line, end='')