'Changing the string value that uses return file.name after creating name file

I'm really new to Python. Only one week of study so please I know this is not the best possible way of doing things but I'm trying. So I have this memo "muistio.txt"and after program checks if it already exists or not you can make some simple inputs. Everything works okay but after Choice 4 I want to change part print("You're at currently",name) for the file name that was created and using it until new one is created or program is closed. How do I achieve this?

import time


def finding_file():
    try:
        file = open("muistio.txt", "r")
        return file.name

    except IOError:
        file = open("note.txt", "w")
        print("Can't find the file, creating.")
        filename = file.name
        return filename


def new_memo():
    memo = input("Give name: ")
    try:
        memo = open(memo, "r")
        print("Using memo: " + memo.name)
        memoname = memo.name
        return memoname

    except IOError:
        memo = open(memo, "w")
        print("Memo not found, creating")
        memoname = memo.name
        return memoname


def main():
    while True:
        name = finding_file(),new_memo()
        print("You're at currently", name)
        print("(1) Read\n(2) Add\n(3) Empty\n(4)Change\n(5) Quit")
        choice = int(input("What you want to do?: "))

        if choice == 1:
            memo = open("muistio.txt", "r")
            inside = memo.read()
            print(inside)
            memo.close()

        elif choice == 2:
            memo = open("muistio.txt", "a")
            writing = input("Write new note: ")
            timestamp = time.strftime("%X %x")
            memo.write(writing+":::"+timestamp)
            memo.close()

        elif choice == 3:
           memo = open("muistio.txt", "w")
           memo.truncate(0)
           print("Memo empty.")
           memo.close()

        elif choice == 4:
            new_memo()

        elif choice == 5:
            print("Quitting.")
            break


if __name__ == "__main__":
    main()



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source