samedi 23 février 2019

Access file.txt from google drive

I have a code that picks a random word from a file.txt saved on my computer drive C. I would like to work on my code on my work PC or on my ipad (I am using Pythonista app on my ipad). However the file.txt where I get the random word for my code is stored on my home PC. I know I can copy the file and save it on my work PC too (that what I am doing at the moment but i cant do this for my ipad). Another problem is I keep forgetting to update my work file.txt when I add more words to the file.txt on my home PC ..... I have moved the file.txt to my Google drive.

My question is how do I write the file path in my code to look into my Google drive where the file.txt is and get the random word. This way I can work with the file.txt anywhere

I tried this but didn't work

products = r"C:\Users\colin\Google Drive\Python\file.txt"

but it didnt word on my work PC or my ipad.




Aucun commentaire:

Enregistrer un commentaire