Please I need help with this python code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

8th Dec 2018, 8:01 PM
Sebas Leon
3 Answers
+ 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 ;)
8th Dec 2018, 9:01 PM
visph
visph - avatar
+ 2
Sebas Leon post a link to the full code, I'll do my best to help you
8th Dec 2018, 8:05 PM
Dlite
Dlite - avatar
0
I don't have a link to the full code
8th Dec 2018, 8:15 PM
Sebas Leon