Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/tutorial/stdlib.rst

    r2 r391  
    1515
    1616   >>> import os
    17    >>> os.system('time 0:02')
    18    0
    1917   >>> os.getcwd()      # Return the current working directory
    2018   'C:\\Python26'
    21    >>> os.chdir('/server/accesslogs')
     19   >>> os.chdir('/server/accesslogs')   # Change current working directory
     20   >>> os.system('mkdir today')   # Run the command mkdir in the system shell
     21   0
    2222
    2323Be sure to use the ``import os`` style instead of ``from os import *``.  This
     
    7373The :mod:`getopt` module processes *sys.argv* using the conventions of the Unix
    7474:func:`getopt` function.  More powerful and flexible command line processing is
    75 provided by the :mod:`optparse` module.
     75provided by the :mod:`argparse` module.
    7676
    7777
     
    146146
    147147There are a number of modules for accessing the internet and processing internet
    148 protocols. Two of the simplest are :mod:`urllib2` for retrieving data from urls
     148protocols. Two of the simplest are :mod:`urllib2` for retrieving data from URLs
    149149and :mod:`smtplib` for sending mail::
    150150
     
    279279           self.assertEqual(average([20, 30, 70]), 40.0)
    280280           self.assertEqual(round(average([1, 5, 7]), 1), 4.3)
    281            self.assertRaises(ZeroDivisionError, average, [])
    282            self.assertRaises(TypeError, average, 20, 30, 70)
     281           with self.assertRaises(ZeroDivisionError):
     282               average([])
     283           with self.assertRaises(TypeError):
     284               average(20, 30, 70)
    283285
    284286   unittest.main() # Calling from the command line invokes all tests
Note: See TracChangeset for help on using the changeset viewer.