Sep-01-2022, 02:37 PM
(This post was last modified: Sep-01-2022, 03:04 PM by Gribouillis.)
Thank you for all your advice and suggestions.
I tried again. It still doesnt work. I failed to remove the item by user input. This is my code-
I tried again. It still doesnt work. I failed to remove the item by user input. This is my code-
animalslist = open ('C:\\Users\\defaultuser100000\\animals.txt') items = animalslist.read() nlist = [items] out = str(input("Enter items to be removed")) if out == items: nlist.remove(out) animalslist = open('C:\\Users\\defaultuser100000\\animals.txt', 'w' ) animalslist.write(items) animalslist.close() nlist = [items.replace('\n',' ') for items in nlist] print ("You now have") print (nlist) print("in your list")
Gribouillis write Sep-01-2022, 03:04 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.