Ignore:
Timestamp:
Dec 26, 2018, 8:15:44 PM (17 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Use `print` as a function in non-code

Add parentheses for `print` calls in

- documentation
- docstrings
- comments
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/ftputil.txt

    r1711 r1727  
    185185    ...     f = open("not_there")
    186186    ... except IOError as obj:
    187     ...     print obj.errno
    188     ...     print obj.strerror
     187    ...     print(obj.errno)
     188    ...     print(obj.strerror)
    189189    ...
    190190    2
     
    199199    ...     f = ftp_host.open("not_there")
    200200    ... except IOError as obj:
    201     ...     print obj.errno
    202     ...     print obj.strerror
     201    ...     print(obj.errno)
     202    ...     print(obj.strerror)
    203203    ...
    204204    550
     
    327327
    328328    with ftputil.FTPHost(server, user, password) as ftp_host:
    329         print ftp_host.listdir(ftp_host.curdir)
     329        print(ftp_host.listdir(ftp_host.curdir))
    330330
    331331After the ``with`` block, the ``FTPHost`` instance and the
     
    913913        ftp_host2.remove("some_file")
    914914        # `ftp_host1` will still see the obsolete cache entry!
    915         print ftp_host1.stat("some_file")
     915        print(ftp_host1.stat("some_file"))
    916916        # Will raise an exception since an `FTPHost` object
    917917        # knows of its own changes.
    918         print ftp_host2.stat("some_file")
     918        print(ftp_host2.stat("some_file"))
    919919
    920920At first sight, it may appear to be a good idea to have a shared cache
     
    939939        ftp_host1.stat_cache.invalidate(absolute_path)
    940940        # Will now raise an exception as it should.
    941         print ftp_host1.stat("some_file")
     941        print(ftp_host1.stat("some_file"))
    942942        # Would raise an exception since an `FTPHost` object
    943943        # knows of its own changes, even without `invalidate`.
    944         print ftp_host2.stat("some_file")
     944        print(ftp_host2.stat("some_file"))
    945945
    946946The method ``invalidate`` can be used on any *absolute* path, be it a
     
    12391239            for line in input_file:
    12401240                # Do something with the line, e. g.
    1241                 print line.strip().replace("ftplib", "ftputil")
     1241                print(line.strip().replace("ftplib", "ftputil"))
    12421242
    12431243For more on file objects, see the section `File objects`_ in the
Note: See TracChangeset for help on using the changeset viewer.