sftp 服务器的写入路径 python
Writing path for sftp server python
我在 Python
上使用 pysftp
并尝试 运行 sftp 服务器中某个目录的循环。
我不知道如何写sftp 服务器上的目录路径。我认为连接到服务器并按如下所示编写目录就可以了,但事实并非如此。请让我知道如何编写 sftp 路径以便 python 可以读取它们。
sftp = pysftp.Connection('128.59.164.112', username = '', password = '');
source = sftp.u\'weatherForecast\'/dataRAW/2004/grib/tmax/
试试这个:
import pysftp
sftp = pysftp.Connection('hostname', username='me', password='secret')
sftp.chdir('/home/user/development/Whosebug')
ls = sftp.listdir()
for filename in ls:
print filename
你应该阅读这个:http://pysftp.readthedocs.org/en/latest/index.html
PS1:;在 Python 中是可选的,但在 Pythonic.
中不是
经过反复试验,我弄明白了。
source = 'weatherForecast/dataRAW/2004/grib/tmax/'
destination= 'sftp.u\'weatherForecast\'/csv/2004/tmax'
这行得通。
我在 Python
上使用 pysftp
并尝试 运行 sftp 服务器中某个目录的循环。
我不知道如何写sftp 服务器上的目录路径。我认为连接到服务器并按如下所示编写目录就可以了,但事实并非如此。请让我知道如何编写 sftp 路径以便 python 可以读取它们。
sftp = pysftp.Connection('128.59.164.112', username = '', password = '');
source = sftp.u\'weatherForecast\'/dataRAW/2004/grib/tmax/
试试这个:
import pysftp
sftp = pysftp.Connection('hostname', username='me', password='secret')
sftp.chdir('/home/user/development/Whosebug')
ls = sftp.listdir()
for filename in ls:
print filename
你应该阅读这个:http://pysftp.readthedocs.org/en/latest/index.html
PS1:;在 Python 中是可选的,但在 Pythonic.
中不是经过反复试验,我弄明白了。
source = 'weatherForecast/dataRAW/2004/grib/tmax/'
destination= 'sftp.u\'weatherForecast\'/csv/2004/tmax'
这行得通。