What is current working directory of this app coz I m unable to import file. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is current working directory of this app coz I m unable to import file.

How to import file in py of sololearn ide https://code.sololearn.com/c28uFEnnvmP1/?ref=app

17th May 2020, 6:55 PM
Abhishek Mohan
Abhishek Mohan - avatar
7 Answers
+ 3
you didnt called the function use os.getcwd(). you forgot the brackets. Also if you are having trouble using file in python you can put the required file in the root directory of python script or you can write full path to the file in your script using double slashes or raw string
17th May 2020, 6:59 PM
Mayank
Mayank - avatar
+ 1
But I dont know what are my root directories??
17th May 2020, 7:01 PM
Abhishek Mohan
Abhishek Mohan - avatar
+ 1
After calling function, the output is not desirable... Plz help
17th May 2020, 7:03 PM
Abhishek Mohan
Abhishek Mohan - avatar
+ 1
are you using any specific ide? Root directory is the one where your python script file is located, so if you are using any specific ide you can check from there where the file is saved or as I said above use getcwd() with brackets and it will work
17th May 2020, 7:04 PM
Mayank
Mayank - avatar
+ 1
I'm using sololearn ide in android. And getcwd() is only showing '\' this
17th May 2020, 7:06 PM
Abhishek Mohan
Abhishek Mohan - avatar
+ 1
Why and what kind of file do you want to use in sololearn? I dont think you can do that in sololearn.
17th May 2020, 7:08 PM
Mayank
Mayank - avatar
+ 1
I want to use txt file. Just for trying os module
17th May 2020, 7:09 PM
Abhishek Mohan
Abhishek Mohan - avatar