22\usepackage [T1 ]{fontenc }
33
44% Things to do:
5- % Add a section on file I/O
6- % Write a chapter entitled ``Some Useful Modules''
7- % --re, math+cmath
85% Should really move the Python startup file info to an appendix
96
107\title {Python Tutorial}
@@ -4397,7 +4394,7 @@ \section{Operating System Interface\label{os-interface}}
43974394
43984395\begin {verbatim }
43994396>>> import os
4400- >>> os.system('copy /data/mydata.fil /backup/mydata.fil ')
4397+ >>> os.system('time 0:02 ')
440143980
44024399>>> os.getcwd() # Return the current working directory
44034400'C:\\Python24'
@@ -4484,9 +4481,7 @@ \section{String Pattern Matching\label{string-pattern-matching}}
44844481
44854482The \ulink {\module {re}}{../lib/module-re.html}
44864483module provides regular expression tools for advanced string processing.
4487- When only simple capabilities are needed, string methods are preferred
4488- because they are easier to read and debug. However, for more
4489- sophisticated applications, regular expressions can provide succinct,
4484+ For complex matching and manipulation, regular expressions offer succinct,
44904485optimized solutions:
44914486
44924487\begin {verbatim }
@@ -4497,6 +4492,13 @@ \section{String Pattern Matching\label{string-pattern-matching}}
44974492'cat in the hat'
44984493\end {verbatim }
44994494
4495+ When only simple capabilities are needed, string methods are preferred
4496+ because they are easier to read and debug:
4497+
4498+ \begin {verbatim }
4499+ >>> 'tea for too'.replace('too', 'two')
4500+ 'tea for two'
4501+ \end {verbatim }
45004502
45014503\section {Mathematics\label {mathematics } }
45024504
0 commit comments