Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Read File Issue
So basically i'm trying to read something from a simple text file, and i don't really get any errors but the output is blank. Any help is appreciated :-)

employee_file = open("asa.txt", "r")


Process finished with exit code 0
maybe the text file is empty?
It's not...

Dammit i guess it's a unique problem only on my computer, i have tried with 3 diffrent text files, still same result.. Also i have tried to "r+" and "w" still..
Did you start the script in the same directory that contains the text file?

You can try the full path

employee_file = "/Path/To/asa.txt"
with open(employee_file, 'r') as f:    
I just fixed it :D. The problem was with the software and not the actual code. I do not know why?? But after installing Submlime Text everything worked perfectly fine, i used PyCharm before. So weird... It should work either way. Thank u so much for trying to help.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Read csv file through PyCharm kimx0961 3 423 Aug-01-2021, 07:05 PM
Last Post: perfringo
  Why it does not print( Rejaul84 1 396 Jul-01-2021, 10:37 PM
Last Post: bowlofred
  Read and write active Excel file euras 4 523 Jun-29-2021, 11:16 PM
Last Post: Pedroski55
  [Solved] Trying to read specific lines from a file Laplace12 7 761 Jun-21-2021, 11:15 AM
Last Post: Laplace12
  [Solved] Using readlines to read data file and sum columns Laplace12 4 505 Jun-16-2021, 12:46 PM
Last Post: Laplace12
  Read file, reformat and write new file bryanmartin113 1 509 Jun-08-2021, 09:27 PM
Last Post: Larz60+
  Read/Write binary file deanhystad 3 926 Feb-01-2021, 10:29 AM
Last Post: Larz60+
  how to change the range of read CSV file every time python file runs greenpine 6 987 Dec-08-2020, 10:11 PM
Last Post: greenpine
  Using a .bat file to execute simple anaconda commands in Windows 10 gacg1 0 1,133 Nov-30-2020, 03:24 PM
Last Post: gacg1
  How to read CSV file one row at the time in a range and some delay in between greenpine 2 1,486 Nov-20-2020, 02:26 PM
Last Post: greenpine

Forum Jump:

User Panel Messages

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