Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Traceback error
#2
As it is, looks like you are trying to print the 'txt' attribute of Employees class.

Or you want to print the content of the file?

Write into the file:
with open("Employees.txt"), 'a') as employee_file:
    employee_file.write("\nToby - Human resources")
    employee_file.write("\nKelly - Customer service")
Read and print the content:
with open("Employees.txt"), 'r') as employee_file: # open for reading
    data = employee_file.read()

print(data)
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
Traceback error - by tjnichols - Sep-24-2018, 04:44 PM
RE: Traceback error - by wavic - Sep-24-2018, 05:26 PM
RE: Traceback error - by tjnichols - Sep-24-2018, 07:18 PM
RE: Traceback error - by wavic - Sep-25-2018, 07:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Traceback error tjnichols 8 4,206 Sep-26-2018, 08:14 PM
Last Post: ThiefOfTime

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020