From 1b8dcbcc5782a7809d23d5bff1baeb5fee74068e Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Fri, 28 Jul 2023 12:11:42 -0400 Subject: docs: clarify what str.split does The wording was a bit confusing and misled at least one person into thinking it behaved like `str.replace('c', '')` operating on the entire line. Tweak the wording to be more precise and avoid this confusion. --- docs/markdown/Syntax.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/markdown') diff --git a/docs/markdown/Syntax.md b/docs/markdown/Syntax.md index f63125e..9958db5 100644 --- a/docs/markdown/Syntax.md +++ b/docs/markdown/Syntax.md @@ -252,13 +252,13 @@ s = s.replace('as', 'are') #### .strip() ```meson -# Similar to the Python str.strip(). Removes leading/ending spaces and newlines +# Similar to the Python str.strip(). Removes leading/ending spaces and newlines. define = ' -Dsomedefine ' stripped_define = define.strip() # 'stripped_define' now has the value '-Dsomedefine' # You may also pass a string to strip, which specifies the set of characters to -# be removed. +# be removed instead of the default whitespace. string = 'xyxHelloxyx'.strip('xy') # 'string' now has the value 'Hello' ``` -- cgit v1.1