From 5f50cf5137fe0191b68cca6d69ca329c90c44939 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Sun, 16 Aug 2009 10:48:03 -0400 Subject: [PATCH] markup fiddling --- comprehensions.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/comprehensions.html b/comprehensions.html index 702948b..2969380 100644 --- a/comprehensions.html +++ b/comprehensions.html @@ -68,13 +68,13 @@ body{counter-reset:h1 3}
 >>> import os
 >>> print(os.path.join('/Users/pilgrim/diveintopython3/examples/', 'humansize.py'))              
-/Users/pilgrim/diveintopython3/examples/humansize.py
+/Users/pilgrim/diveintopython3/examples/humansize.py
 >>> print(os.path.join('/Users/pilgrim/diveintopython3/examples', 'humansize.py'))               
-/Users/pilgrim/diveintopython3/examples\humansize.py
+/Users/pilgrim/diveintopython3/examples\humansize.py
 >>> print(os.path.expanduser('~'))                                                               
-c:\Users\pilgrim
+c:\Users\pilgrim
 >>> print(os.path.join(os.path.expanduser('~'), 'diveintopython3', 'examples', 'humansize.py'))  
-c:\Users\pilgrim\diveintopython3\examples\humansize.py
+c:\Users\pilgrim\diveintopython3\examples\humansize.py
  1. The os.path.join() function constructs a pathname out of one or more partial pathnames. In this case, it simply concatenates strings.
  2. In this slightly less trivial case, join will add an extra backslash to the pathname before joining it to the filename. I was overjoyed when I discovered this, since addSlashIfNecessary() is one of the stupid little functions I always need to write when building up my toolbox in a new language. Do not write this stupid little function in Python; smart people have already taken care of it for you.