This repository has been archived on 2025-12-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2024-09-20 14:17:13 +03:00

23 lines
367 B
Python

def sortValue(line):
line_fields = line.strip().split(',')
price = float(line_fields[2])
return price
f1 = open("houseLahti.txt")
contents = f1.readlines()
# sorting using our custom logic
contents.sort(key=sortValue)
f1.close()
#writing into new file
f2 = open("salehouseLahti.txt","w")
for line in contents:
f2.write(line)
f2.close()