Skip to content

Commit ff31011

Browse files
committed
mistune-compatible link, more explicit example
1 parent 7628d74 commit ff31011

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

handy-stuff-strings.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,12 @@ Indexing with negative values works like this:
148148

149149
## String methods
150150

151-
Python's strings have many useful methods. [The official documentation]
152-
(https://docs.python.org/3/library/stdtypes.html#string-methods) covers
153-
them all, but I'm going to just show some of the most commonly used ones
154-
briefly. Python also comes with built-in documentation about the string
155-
methods and we can run `help(str)` to read it.
151+
Python's strings have many useful methods.
152+
[The official documentation](https://docs.python.org/3/library/stdtypes.html#string-methods)
153+
covers them all, but I'm going to just show some of the most commonly
154+
used ones briefly. Python also comes with built-in documentation about
155+
the string methods and we can run `help(str)` to read it. You can also
156+
get help about one string method at a time, like `help(str.upper)`.
156157

157158
Again, nothing can modify strings in-place. Most string methods
158159
return a new string, but things like `our_string = our_string.upper()`
@@ -179,8 +180,8 @@ True
179180
False
180181
>>> our_string.replace('World', 'there')
181182
'Hello there!'
182-
>>> our_string.replace('l', 'ł', 1) # only replace one l
183-
'Hełlo World!'
183+
>>> our_string.replace('o', '@', 1) # only replace one o
184+
'Hell@ World!'
184185
>>> ' hello 123 '.lstrip() # left strip
185186
'hello 123 '
186187
>>> ' hello 123 '.rstrip() # right strip

0 commit comments

Comments
 (0)