File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,27 @@ Now if you want to multiline strings you have to use triple single/double quotes
34
34
multiline string, so you can
35
35
write many lines
36
36
37
+
38
+ We can have two string literals side by side, and it will behave like a single string. For example
39
+
40
+ ::
41
+
42
+ >>> s = "Hello " "World"
43
+ >>> print(s)
44
+ Hello World
45
+
46
+ This will help you to spilt a long string into smaller chunks in function calls.
47
+
48
+
49
+ You can find length of any string using the `len ` function call.
50
+
51
+ ::
52
+
53
+ >>> s = "Python"
54
+ >>> len(s)
55
+ 6
56
+
57
+
37
58
Different methods available for Strings
38
59
=======================================
39
60
@@ -207,3 +228,20 @@ The output
207
228
The number of words in the line are 5
208
229
209
230
231
+ Iterating over all characters of a string
232
+ ==========================================
233
+
234
+ You can iterate over a string using simple `for ` loop.
235
+
236
+ ::
237
+
238
+ >>> for ch in "Python":
239
+ ... print(ch)
240
+ ...
241
+ P
242
+ y
243
+ t
244
+ h
245
+ o
246
+ n
247
+
You can’t perform that action at this time.
0 commit comments