+ 1
Please I need help with this python code
so far the code looks like this, but it is not working, I am trying to simply read a text file put that data in a function call and create a single tuple with the data. filename = input("Please input name of file") file = open(filename, 'r') for line in file: emp = employee(line) emp.txt = (str(emp)) def staff_tuple(x): tuple = x return tuple print (staff_tuple(emp.txt)) thank you for your time.
3 Respostas
+ 5
# If your goal is just to print the text file content, you could read it at once with file.read():
filename = input("Please input name of file")
file = open(filename, 'r')
print(file.read())
file.close() # explicit file close is cleaner and better practice ;)
+ 2
Sebas Leon post a link to the full code, I'll do my best to help you
0
I don't have a link to the full code