Browse Source

Tuple, Metaclass, Text to speech

pull/135/head
Jure Šorn 2 years ago
parent
commit
40593d4d31
2 changed files with 14 additions and 14 deletions
  1. 12
      README.md
  2. 16
      index.html

12
README.md

@ -144,7 +144,7 @@ Tuple
----- -----
**Tuple is an immutable and hashable list.** **Tuple is an immutable and hashable list.**
```python ```python
<tuple> = ()
<tuple> = () # Or: tuple()
<tuple> = (<el>,) # Or: <el>, <tuple> = (<el>,) # Or: <el>,
<tuple> = (<el_1>, <el_2> [, ...]) # Or: <el_1>, <el_2> [, ...] <tuple> = (<el_1>, <el_2> [, ...]) # Or: <el_1>, <el_2> [, ...]
``` ```
@ -2253,7 +2253,7 @@ class MyClass(metaclass=MyMetaClass):
### Type Diagram ### Type Diagram
```python ```python
type(MyClass) == MyMetaClass # MyClass is an instance of MyMetaClass.
type(MyClass) == MyMetaClass # MyClass is an instance of MyMetaClass.
type(MyMetaClass) == type # MyMetaClass is an instance of type. type(MyMetaClass) == type # MyMetaClass is an instance of type.
``` ```
@ -2271,7 +2271,7 @@ type(MyMetaClass) == type # MyMetaClass is an instance of type.
### Inheritance Diagram ### Inheritance Diagram
```python ```python
MyClass.__base__ == object # MyClass is a subclass of object.
MyClass.__base__ == object # MyClass is a subclass of object.
MyMetaClass.__base__ == type # MyMetaClass is a subclass of type. MyMetaClass.__base__ == type # MyMetaClass is a subclass of type.
``` ```
@ -2920,9 +2920,9 @@ with wave.open('test.wav', 'rb') as file:
```python ```python
# $ pip3 install pyttsx3 # $ pip3 install pyttsx3
import pyttsx3 import pyttsx3
<Engine> = pyttsx3.init() # Returns a new Engine.
<Engine>.say(<str>) # Stages the string to be read.
<Engine>.runAndWait() # Reads all staged strings while blocking.
engine = pyttsx3.init()
engine.say('Sally sells seashells by the seashore.')
engine.runAndWait()
``` ```

16
index.html

@ -54,7 +54,7 @@
<body> <body>
<header> <header>
<aside>June 23, 2022</aside>
<aside>June 26, 2022</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a> <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</header> </header>
@ -182,7 +182,7 @@ Counter({<span class="hljs-string">'blue'</span>: <span class="hljs-number">3</s
</code></pre></div> </code></pre></div>
<div><h2 id="tuple"><a href="#tuple" name="tuple">#</a>Tuple</h2><p><strong>Tuple is an immutable and hashable list.</strong></p><pre><code class="python language-python hljs">&lt;tuple&gt; = ()
<div><h2 id="tuple"><a href="#tuple" name="tuple">#</a>Tuple</h2><p><strong>Tuple is an immutable and hashable list.</strong></p><pre><code class="python language-python hljs">&lt;tuple&gt; = () <span class="hljs-comment"># Or: tuple()</span>
&lt;tuple&gt; = (&lt;el&gt;,) <span class="hljs-comment"># Or: &lt;el&gt;,</span> &lt;tuple&gt; = (&lt;el&gt;,) <span class="hljs-comment"># Or: &lt;el&gt;,</span>
&lt;tuple&gt; = (&lt;el_1&gt;, &lt;el_2&gt; [, ...]) <span class="hljs-comment"># Or: &lt;el_1&gt;, &lt;el_2&gt; [, ...]</span> &lt;tuple&gt; = (&lt;el_1&gt;, &lt;el_2&gt; [, ...]) <span class="hljs-comment"># Or: &lt;el_1&gt;, &lt;el_2&gt; [, ...]</span>
</code></pre></div> </code></pre></div>
@ -1852,7 +1852,7 @@ delattr(&lt;object&gt;, <span class="hljs-string">'&lt;attr_name&gt;'</span>)
<pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>MyClass.a, MyClass.b <pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>MyClass.a, MyClass.b
(<span class="hljs-string">'abcde'</span>, <span class="hljs-number">12345</span>) (<span class="hljs-string">'abcde'</span>, <span class="hljs-number">12345</span>)
</code></pre> </code></pre>
<div><h3 id="typediagram">Type Diagram</h3><pre><code class="python language-python hljs">type(MyClass) == MyMetaClass <span class="hljs-comment"># MyClass is an instance of MyMetaClass.</span>
<div><h3 id="typediagram">Type Diagram</h3><pre><code class="python language-python hljs">type(MyClass) == MyMetaClass <span class="hljs-comment"># MyClass is an instance of MyMetaClass.</span>
type(MyMetaClass) == type <span class="hljs-comment"># MyMetaClass is an instance of type.</span> type(MyMetaClass) == type <span class="hljs-comment"># MyMetaClass is an instance of type.</span>
</code></pre></div> </code></pre></div>
@ -1866,7 +1866,7 @@ type(MyMetaClass) == type <span class="hljs-comment"># MyMetaClass is
┃ str ──────────╯ ┃ ┃ str ──────────╯ ┃
┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━┷━━━━━━━━━━━━━┛
</code></pre> </code></pre>
<div><h3 id="inheritancediagram">Inheritance Diagram</h3><pre><code class="python language-python hljs">MyClass.__base__ == object <span class="hljs-comment"># MyClass is a subclass of object.</span>
<div><h3 id="inheritancediagram">Inheritance Diagram</h3><pre><code class="python language-python hljs">MyClass.__base__ == object <span class="hljs-comment"># MyClass is a subclass of object.</span>
MyMetaClass.__base__ == type <span class="hljs-comment"># MyMetaClass is a subclass of type.</span> MyMetaClass.__base__ == type <span class="hljs-comment"># MyMetaClass is a subclass of type.</span>
</code></pre></div> </code></pre></div>
@ -2379,9 +2379,9 @@ write_to_wav_file(<span class="hljs-string">'test.wav'</span>, samples_f)
<div><h3 id="texttospeech">Text to Speech</h3><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install pyttsx3</span> <div><h3 id="texttospeech">Text to Speech</h3><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install pyttsx3</span>
<span class="hljs-keyword">import</span> pyttsx3 <span class="hljs-keyword">import</span> pyttsx3
&lt;Engine&gt; = pyttsx3.init() <span class="hljs-comment"># Returns a new Engine.</span>
&lt;Engine&gt;.say(&lt;str&gt;) <span class="hljs-comment"># Stages the string to be read.</span>
&lt;Engine&gt;.runAndWait() <span class="hljs-comment"># Reads all staged strings while blocking.</span>
engine = pyttsx3.init()
engine.say(<span class="hljs-string">'Sally sells seashells by the seashore.'</span>)
engine.runAndWait()
</code></pre></div> </code></pre></div>
<div><h2 id="synthesizer"><a href="#synthesizer" name="synthesizer">#</a>Synthesizer</h2><div><h4 id="playspopcornbygershonkingsley">Plays Popcorn by Gershon Kingsley:</h4><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install simpleaudio</span> <div><h2 id="synthesizer"><a href="#synthesizer" name="synthesizer">#</a>Synthesizer</h2><div><h4 id="playspopcornbygershonkingsley">Plays Popcorn by Gershon Kingsley:</h4><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install simpleaudio</span>
@ -2901,7 +2901,7 @@ $ pyinstaller script.py --add-data '&lt;path&gt;:.' <span class="hljs-comment">
<footer> <footer>
<aside>June 23, 2022</aside>
<aside>June 26, 2022</aside>
<a href="https://gto76.github.io" rel="author">Jure Šorn</a> <a href="https://gto76.github.io" rel="author">Jure Šorn</a>
</footer> </footer>

Loading…
Cancel
Save