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.
here still errors this:
filename.remove("done")
still showing 'str' error.
filename=filename+name
use above code
Comments
Post a Comment