[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
filename = 'monkeys.jpg' # remote/local filename password = getpass.getpass('Pswd?') remoteaddr = 'ftp://lutz:%
[email protected]
/%s; ...
For more urllib download examples, see the section on HTTP later in this chapter, and the server-side examples in Chapter 15. As ...
dir ='.', user=('lutz', getpass('Pswd?')), refetch=True) rest is the same if input('Open file?') in ['Y', 'y']: from PP4E.System ...
from ftplib import FTP # socket-based FTP tools from os.path import exists # file existence test def getfile(file, site, dir, us ...
These two arguments are coded as Python 3.X default keyword-only arguments, so if used they must be passed by name, not position ...
strip the local directory with os.path.split to get the remote name, or accept two distinct filename arguments—local and remote. ...
""" if verbose: print('Uploading', file) local = open(file, 'rb') # local file of same name remote = ftplib.FTP(site) # connect ...
site = 'ftp.rmi.net' # Monty Python theme song dir = '.' user = ('lutz', getpass('Pswd?')) getfile(file, site, dir, user) # fetc ...
C:\...\PP4E\Internet\Ftp> del sousa.au C:\...\PP4E\Internet\Ftp> python >>> from getfile import getfile >>& ...
root.title(self.title) labels = ['Server Name', 'Remote Dir', 'File Name', 'Local Dir', 'User Name?', 'Password?'] Form.init(sel ...
If you flip back to the end of the preceding chapter, you’ll find that this version is similar in structure to its counterpart t ...
As currently coded, further download status messages, including any FTP error mes- sages, show up in the console window; here ar ...
We learned about ways to work around the no-GUI rule for threads in Chapter 10, and we will apply such techniques when we explor ...
from tkinter import mainloop import putfile, getfilegui class FtpPutfileForm(getfilegui.FtpForm): title = 'FtpPutfileGui' mode = ...
Password? => xxxxxxxx Remote Dir =>. Upload of "about-pp.html" successful Finally, we can bundle up both GUIs in a single ...
Transferring Directories with ftplib Once upon a time, I used Telnet to manage my website at my Internet Service Provider (ISP). ...
More generally, this script (shown in Example 13-10) will download a directory full of files to any machine with Python and sock ...
localpath = os.path.join(localdir, remotename) print('downloading', remotename, 'to', localpath, end=' ') print('as', maintype, ...
the listing’s text into a list of filenames. We can pass it a remote directory to be listed; by default it lists the current ser ...
Windows happens when data is written to the file. As discussed earlier, text mode also means that the file’s write method will a ...
«
41
42
43
44
45
46
47
48
49
50
»
Free download pdf