Python File errors -


file = input("please enter name txt. file: ")  filename = (file + ".txt") write = "w" append = "a"  file = [] name = " " while name != "done" :     name = input("please enter guest name (enter done if there no   more names) : ").upper()    filename.append(name) filename.remove("done") print("the guests list in alphabetical order, , save in " + filename + " :") file.sort() u in file :     print(u) file = open(filename, mode = write) file.write(name) file.close() print("file written successfully.") 

i practicing write file in python, bad happened.

the code. the error description.

here still errors this:

filename.remove("done") 

still showing 'str' error.

filename=filename+name 

use above code


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -