I need to access and open a file on a server with python. I have a Centos server which I can access from terminal with ssh [email protected] and enter the user password.
Question
If I have a file on the server in this path: /var/document.txt what do I write to access that path and open the document.txt on my local machine?
If the file was on my local machine, I could read it with this:
import glob
# for example if i want to see file in the folder
for f in glob.glob('/var/*.*'):
print(f) # output --> document.txt
# read file
read = open(f, 'r')
How do I access the file if it is on the server? I do not want to download the file, edit it and upload it again.