Browse Source

List

pull/52/head
Jure Šorn 5 years ago
parent
commit
0f76f2dbb8
2 changed files with 2 additions and 2 deletions
  1. 2
      README.md
  2. 2
      index.html

2
README.md

@ -53,7 +53,7 @@ flatter_list = list(itertools.chain.from_iterable(<list>))
product_of_elems = functools.reduce(lambda out, x: out * x, <collection>) product_of_elems = functools.reduce(lambda out, x: out * x, <collection>)
list_of_chars = list(<str>) list_of_chars = list(<str>)
``` ```
* **Check out module [operator](#operator) for alternative versions of examples.**
* **Module [operator](#operator) provides functions itemgetter() and mul() that offer the same functionality as lambda expressions above.**
```python ```python
<int> = <list>.count(<el>) # Returns number of occurrences. Also works on strings. <int> = <list>.count(<el>) # Returns number of occurrences. Also works on strings.

2
index.html

@ -250,7 +250,7 @@ product_of_elems = functools.reduce(<span class="hljs-keyword">lambda</span> out
list_of_chars = list(&lt;str&gt;) list_of_chars = list(&lt;str&gt;)
</code></pre> </code></pre>
<ul> <ul>
<li><strong>Check out module <a href="#operator">operator</a> for alternative versions of examples.</strong></li>
<li><strong>Module <a href="#operator">operator</a> provides functions itemgetter() and mul() that offer the same functionality as lambda expressions above.</strong></li>
</ul> </ul>
<pre><code class="python language-python hljs">&lt;int&gt; = &lt;list&gt;.count(&lt;el&gt;) <span class="hljs-comment"># Returns number of occurrences. Also works on strings.</span> <pre><code class="python language-python hljs">&lt;int&gt; = &lt;list&gt;.count(&lt;el&gt;) <span class="hljs-comment"># Returns number of occurrences. Also works on strings.</span>
index = &lt;list&gt;.index(&lt;el&gt;) <span class="hljs-comment"># Returns index of first occurrence or raises ValueError.</span> index = &lt;list&gt;.index(&lt;el&gt;) <span class="hljs-comment"># Returns index of first occurrence or raises ValueError.</span>

Loading…
Cancel
Save