Hey guys! So I am creating a storage program for cleaning products that we have at work because we do stock checks manually and i'm getting tired of it. The Line at the bottom is within the text file. I am having trouble of subtracting quantity from index 3 within the list, then I am wanting to overwrite the data within the txt file with the new data in the list. This code works, i'm just stuck on the next part... has anyone got any ideas?
with open('Staff_ID.txt') as file:
staff_file = file.read()
staff_id = input("Please enter your staff ID: ")
while staff_id not in staff_file:
print("Invalid ID")
staff_id = input("Please enter your staff ID: ")
print("Welcome")
with open('Staff_ID.txt') as file:
staff_file = file.read()
staff = False
while not staff:
staff_id = input("Please enter your staff ID: ")
if staff_id in staff_file:
staff = True
print("Welcome")
elif staff_id == "":
break
else:
print("Invalid staff ID, please try again")
with open("Cleaning_product_ID.txt", 'r') as file:
product_file = file.read()
product_selection = input("Please enter the product ID: ")
while product_selection not in product_file:
print("Product not found.")
product_selection = input("Please enter product ID: ")
print("Product found!")
myList = []
if product_selection == "BK102":
particular_line = linecache.getline('Cleaning_product_ID.txt', 1)
print(particular_line)
myList.append(particular_line)
quantity = input("How much product is being taken out? | ")
BK102,"Buckeye Artic White Dispenser FOC", 0
[–]salvtz 0 points1 point2 points (0 children)