This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bioinformatics python

In python, with open () as file, I have been trying to open a file in python but not opening. The file is located in my pc, documents, file name(fastafl), and it is a text documents, I used file path r"c... Still did not open, how do I open it Also how do I make the file appear in python directory

python

1 answer

Three reasons come to mind: 1) the file doesn't exist; 2) the file does exist but it doesn't belong to you, so you don't have the privilege to open it; 3) your file path has a space character in it, in which case it must be enclosed in quotation marks, and most likely you will need to use forward slashes instead of backslashes.

Since you didn't give us the error message, I am going to guess that it is #3. This is something that you can find about by Googling.

Thank you very much, I am new to python. Just saw I need to create full path or put my file in python script. Thank you

Log in to answer this question.