Below is my function and output. I want to remove the \n
present in the output.
def printInventory():
fh = open("stock.txt","r")
print('Current Inventory')
print('-----------------')
L=fh.readlines()
print("List of all Stock Items")
for i in L:
L=i.split(",")
print(L)
CHOICE = int(input('Enter 98 to continue or 99 to exit: '))
if CHOICE == 98:
menuDisplay()
else:
exit()
Output:
List of all Stock Items ['APPLE', '100\n'] ['BANANA', '50\n'] ['CHILLI', '100\n'] ['MANGO', '300\n']
I would like to remove the \n
from the output