You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
item-sort/sort.py

31 lines
582 B
Python

# Sort items
import pickle
def write(bins):
file = open("bins.txt","w+b")
pickle.dump(bins, file)
file.close()
def sort(input):
file = open("bins.txt","a+b")
file.close()
file = open("bins.txt", "rb")
bins = pickle.load(file)
if len(bins) == 0:
bins = ['Unknown']
file.close()
write(bins)
#file.write(str(bins))
if bins.count(input) == 0:
bins.append(input)
bin = bins.index(input)
5 years ago
#print(str(bins))
#print(bin)
write(bins)
return bin
def clear():
write(["Unknown"])
#write(["Unknown"])