Skip to content

Commit 1fbaee9

Browse files
authored
Update 05-Strings.md
1 parent 3b885b4 commit 1fbaee9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

python/05-Strings.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ text = 'The value of pi is ' + str(pi) ## yes
4444
| <a>s.split('delim') </a> |Returns a list of substrings separated by the given delimiter. The delimiter is not a regular expression, it's just text. 'aaa,bbb,ccc'.split(',') -> ['aaa', 'bbb', 'ccc']. As a convenient special case s.split() (with no arguments) splits on all whitespace chars.
4545
| <a>s.join(list) </a> |Opposite of split(), joins the elements in the given list together using the string as the delimiter. e.g. '---'.join(['aaa', 'bbb', 'ccc']) -> aaa---bbb---ccc
4646

47-
</br>
47+
4848

4949
<h2>String Slices</h2>
5050

@@ -57,7 +57,7 @@ text = 'The value of pi is ' + str(pi) ## yes
5757
| <a>s[:]</a> | is 'Hello' -- omitting both always gives us a copy of the whole thing (this is the pythonic way to copy a sequence like a string or list)
5858
| <a>s[1:100]</a> | an index that is too big is truncated down to the string length
5959

60-
</br>
60+
6161

6262
>The standard zero-based index numbers give easy access to chars near the start of the string. As an alternative, Python uses negative numbers to give easy access to the chars at the end of the string: s[-1] is the last char 'o', s[-2] is 'l' the next-to-last char, and so on. Negative index numbers count back from the end of the string:</br>
6363
@@ -68,7 +68,7 @@ text = 'The value of pi is ' + str(pi) ## yes
6868
| <a>s[:-3]</a> | is 'He' -- going up to but not including the last 3 chars
6969
| <a>s[-3:]</a>
7070
| is 'llo' -- starting with the 3rd char from the end and extending to the end of the string
71-
</br>
71+
7272

7373
<h2>String %</h2>
7474

0 commit comments

Comments
 (0)