You are using the wrong slashes (i.e \
instead of \\
). Also, check if the path you are trying to reach exists (Computer being a subfolder of the Users folder doesn't sound right).
In addition, if you are going with string concatenation, I'd recommend using python's f-strings, like so:
fh = open(f"C:\\Users\\Computer\\Desktop\\Assignment 7.1\\{fname})
However, to avoid issues as you just encountered, I would just use os.path.join:
import os
path = os.path.join("C:", "Users", "Computer", "Desktop", "Assignment 7.1", fname)
fh = open(path)
I'd also change the variable names to be separated by underscores.
Secondly, it is preferable to use a context manager (i.e the with
keyword). The advantage is that the file is properly closed after its suite finishes, even if an exception is raised at some point:
import os
file_name = input("Enter file name: ")
path = os.path.join("C:", "Users", "Computer", "Desktop", "Assignment 7.1", fname)
with open(path) as file_handler:
file_content = file_handler.read() # to get the files content
You can also read more about how to handle reading and writing from files in python here.