@@ -261,6 +261,28 @@ Python 3 strings hold unicode data. Python has a few ways to represent strings.
261
261
Byte string ``b'hello' ``
262
262
================ ===========================
263
263
264
+ .. table :: Escape Characters
265
+
266
+ =================== =================
267
+ Escape Sequence Output
268
+ =================== =================
269
+ ``\ `` newline Ignore trailing newline in triple quoted string
270
+ ``\\ `` Backslash
271
+ ``\' `` Single quote
272
+ ``\" `` Double quote
273
+ ``\a `` ASCII Bell
274
+ ``\b `` ASCII Backspace
275
+ ``\n `` Newline
276
+ ``\r `` ASCII carriage return
277
+ ``\t `` Tab
278
+ ``\u12af `` Unicode 16 bit
279
+ ``\U12af89bc `` Unicode 32 bit
280
+ ``N{BLACK STAR} `` Unicode name
281
+ ``\o84 `` Octal character
282
+ ``\xFF `` Hex character
283
+ =================== =================
284
+
285
+
264
286
265
287
.. longtable: format: {p{.3\textwidth} l >{\raggedright\arraybackslash}p{.3\textwidth}}
266
288
@@ -579,17 +601,17 @@ We can access members by position or name (name allows us to be more explicit)::
579
601
``"{}".format(t) `` ``__format__ `` String format of tuple
580
602
``t >= t2 `` ``__ge__ `` Greater or equal. Compares items in tuple from left
581
603
``t[idx] `` ``__getitem__ `` Index operation
582
- ``t > l2 `` ``__gt__ `` Greater. Compares items in tuple from left
604
+ ``t > t2 `` ``__gt__ `` Greater. Compares items in tuple from left
583
605
``hash(t) `` ``__hash__ `` For set/dict insertion
584
606
``for thing in t: `` ``__iter__ `` Iteration
585
607
``t <= t2 `` ``__le__ `` Less than or equal. Compares items in tuple from left
586
- ``len(l ) `` ``__len__ `` Length
608
+ ``len(t ) `` ``__len__ `` Length
587
609
``t < t2 `` ``__lt__ `` Less than. Compares items in tuple from left
588
610
``t * 2 `` ``__mul__ `` Repetition
589
- ``t != l2 `` ``__ne__ `` Not equal
611
+ ``t != t2 `` ``__ne__ `` Not equal
590
612
``repr(t) `` ``__repr__ `` Programmer friendly string
591
613
``foo * t `` ``__rmul__ `` Called if ``foo `` doesn't implement ``__mul__ ``
592
- ``l .__sizeof__() `` ``__sizeof__ `` Bytes for internal representation
614
+ ``t .__sizeof__() `` ``__sizeof__ `` Bytes for internal representation
593
615
``str(l) `` ``__str__ `` User friendly string
594
616
================================== ========================= ============================================================
595
617
@@ -1183,7 +1205,7 @@ Functions can support variable keyword arguments::
1183
1205
but 1 was given
1184
1206
1185
1207
1186
- You can indicate the end of positional parameters by using a single ``* ``. This gives you keyword only parameters (PEP 3102)::
1208
+ You can indicate the end of positional parameters by using a single ``* ``. This gives you * keyword only * parameters (PEP 3102)::
1187
1209
1188
1210
>>> def add_points(*, x1=0, y1=0, x2=0, y2=0):
1189
1211
... return x1 + x2, y1 + y2
@@ -1243,6 +1265,9 @@ You can also combine ``*`` and ``**`` on invocation::
1243
1265
>>> add_all(*sizes, **named_sizes)
1244
1266
10.5
1245
1267
1268
+ Getting Help
1269
+ ------------
1270
+
1246
1271
You can get help on a function that has a docstring by using ``help ``::
1247
1272
1248
1273
>>> help(add_all)
0 commit comments