From 088ea6df572bdf99092ff43627e3fbf595e66d8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 4 Jul 2019 05:08:43 +0200 Subject: [PATCH] List, String --- README.md | 4 ++-- index.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index dc6216b..52097d2 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,6 @@ list_of_chars = list() ``` ```python - = in # For dictionary it checks if key exists. index = .index() # Returns index of first occurrence or raises ValueError. .insert(index, ) # Inserts item at index and moves the rest to the right. = .pop([index]) # Removes and returns item at index or from the end. @@ -309,7 +308,7 @@ String ``` ```python - = .replace(old, new [, count]) # Replaces 'old' with 'new' at most 'count' times. + = in # Checks if string contains a substring. = .startswith() # Pass tuple of strings for multiple options. = .endswith() # Pass tuple of strings for multiple options. = .find() # Returns start index of first match or -1. @@ -317,6 +316,7 @@ String ``` ```python + = .replace(old, new [, count]) # Replaces 'old' with 'new' at most 'count' times. = .isnumeric() # True if str contains only numeric characters. = textwrap.wrap(, width) # Nicely breaks string into lines. ``` diff --git a/index.html b/index.html index c1aa7ca..854c1e5 100644 --- a/index.html +++ b/index.html @@ -237,8 +237,7 @@ flatter_list = list(itertools.chain.from_iterable(<list>)) product_of_elems = functools.reduce(lambda out, x: out * x, <collection>) list_of_chars = list(<str>) -
<bool> = <el> in <collection>  # For dictionary it checks if key exists.
-index = <list>.index(<el>)     # Returns index of first occurrence or raises ValueError.
+
index = <list>.index(<el>)     # Returns index of first occurrence or raises ValueError.
 <list>.insert(index, <el>)     # Inserts item at index and moves the rest to the right.
 <el> = <list>.pop([index])     # Removes and returns item at index or from the end.
 <list>.remove(<el>)            # Removes first occurrence of item or raises ValueError.
@@ -411,13 +410,14 @@ to_exclusive   = <range>.stop
 <list> = <str>.splitlines(keepends=False)    # Splits on line breaks. Keeps them if 'keepends'.
 <str>  = <str>.join(<coll_of_strings>)       # Joins elements using string as separator.
 
-
<str>  = <str>.replace(old, new [, count])   # Replaces 'old' with 'new' at most 'count' times.
+
<bool> = <sub_str> in <str>                  # Checks if string contains a substring.
 <bool> = <str>.startswith(<sub_str>)         # Pass tuple of strings for multiple options.
 <bool> = <str>.endswith(<sub_str>)           # Pass tuple of strings for multiple options.
 <int>  = <str>.find(<sub_str>)               # Returns start index of first match or -1.
 <int>  = <str>.index(<sub_str>)              # Same but raises ValueError.
 
-
<bool> = <str>.isnumeric()                   # True if str contains only numeric characters.
+
<str>  = <str>.replace(old, new [, count])   # Replaces 'old' with 'new' at most 'count' times.
+<bool> = <str>.isnumeric()                   # True if str contains only numeric characters.
 <list> = textwrap.wrap(<str>, width)         # Nicely breaks string into lines.