HELP how can i open and read from files on android | Sololearn: Learn to code for FREE!

+2

HELP how can i open and read from files on android

5/18/2022 10:59:18 AM

MULUKEN ADDIS

12 Answers

New Answer

+2

Muluken Addis Tamene In Pydroid3 πŸ‘‡πŸ‘‡πŸ‘‡ file1 = open("/storage/emulated/0/Android/data/com.moonfrog.ludo.club/files/MFSDKCache.txt") # Reading from file print(file1.read()) file1.close() --------------------------------------------------------------------------------- In Sololearn πŸ‘‡πŸ‘‡πŸ‘‡ https://code.sololearn.com/cD0q3Zfj8i2P/?ref=app

+3

Thanks Lothar and prince kumar

+2

Do you mean using sololearn playground? Sololearn playground has no access to your local storage.

+2

with open("/usr/local/lib/python3.8/importlib/_bootstrap_external.py") as file: print(file.read())

+2

Muluken Addis Tamene , 2 things to consider: - the file with the python code has to be stored physically on the system - file path in android has to start with slash "/storage/emulated/....."

+1

I know, i use pydroid 3 but i get bug , file not found error

+1

Muluken Addis Tamene Use pydroid , there you can access files from your file manager

+1

Check the path again?

+1

Muluken Addis Tamene Send me that code & the location of your file

+1

("storage/emulated/0/Boom Player/cache /discover.txt", "w+") i try this is there a syntax error?

+1

w means write, not read

+1

That is w+ not w