From 941348c155cd9d1cdbdaef5b4d588f2e429e48ef Mon Sep 17 00:00:00 2001 From: dev8nnek Date: Tue, 1 Jul 2025 21:39:31 +0900 Subject: [PATCH] Moved string literal concatenation from basics to manipulating strings The basic or standard string concatenation is using "+" operator which works for both string literals and variables. String literal concatenation is more appropriate on manipulating strings section after multiline strings since this feature can be used to reduce the number of backslashes needed, to split long strings conveniently across long lines, or even to add comments to parts of strings. Reference; https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation , https://docs.python.org/3/tutorial/introduction.html#text , https://stackoverflow.com/questions/34174539/python-string-literal-concatenation --- docs/cheatsheet/basics.md | 2 +- docs/cheatsheet/manipulating-strings.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/cheatsheet/basics.md b/docs/cheatsheet/basics.md index ed27463e..9c7c1dea 100644 --- a/docs/cheatsheet/basics.md +++ b/docs/cheatsheet/basics.md @@ -127,7 +127,7 @@ The _Walrus Operator_, or **Assignment Expression Operator** was firstly introdu String concatenation: ```python ->>> 'Alice' 'Bob' +>>> 'Alice' + 'Bob' # 'AliceBob' ``` diff --git a/docs/cheatsheet/manipulating-strings.md b/docs/cheatsheet/manipulating-strings.md index 03c13fb6..091a63b3 100644 --- a/docs/cheatsheet/manipulating-strings.md +++ b/docs/cheatsheet/manipulating-strings.md @@ -62,6 +62,18 @@ Raw strings are mostly used for