mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
list of characters --> tuple of characters
This commit is contained in:
+1
-1
@@ -93,7 +93,7 @@ My alphabet starts where your alphabet ends! <span class=u>❞</span><br>&m
|
||||
<samp class=pp>'深入 Python 3'</samp></pre>
|
||||
<ol>
|
||||
<li>To create a string, enclose it in quotes. Python strings can be defined with either single quotes (<code>'</code>) or double quotes (<code>"</code>).<!--"-->
|
||||
<li>The built-in <code><dfn>len</dfn>()</code> function returns the length of the string, <i>i.e.</i> the number of characters. This is the same function you use to <a href=native-datatypes.html#extendinglists>find the length of a list</a>. A string is like a list of characters.
|
||||
<li>The built-in <code><dfn>len</dfn>()</code> function returns the length of the string, <i>i.e.</i> the number of characters. This is the same function you use to <a href=native-datatypes.html#extendinglists>find the length of a list, tuple, set, or dictionary</a>. A string is like a tuple of characters.
|
||||
<li>Just like getting individual items out of a list, you can get individual characters out of a string using index notation.
|
||||
<li>Just like lists, you can <dfn>concatenate</dfn> strings using the <code>+</code> operator.
|
||||
</ol>
|
||||
|
||||
Reference in New Issue
Block a user