<div><h2id="json"><ahref="#json"name="json">#</a>JSON</h2><p><strong>Text file format for storing collections of strings and numbers.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">import</span> json
<div><h2id="pickle"><ahref="#pickle"name="pickle">#</a>Pickle</h2><p><strong>Binary file format for storing Python objects.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">import</span> pickle
<bytes> = pickle.dumps(<object>)
<object> = pickle.loads(<bytes>)
<bytes> = pickle.dumps(<object>)<spanclass="hljs-comment"># Converts object to bytes.</span>
<object> = pickle.loads(<bytes>)<spanclass="hljs-comment"># Converts bytes to object.</span>
</code></pre></div>
@ -2429,8 +2429,8 @@ rect = pg.Rect(<span class="hljs-number">240</span>, <span class="hljs-number">2
<int> = <Rect>.collidelist(<list_of_Rect>) <spanclass="hljs-comment"># Returns index of first colliding Rect or -1.</span>
<list> = <Rect>.collidelistall(<list_of_Rect>) <spanclass="hljs-comment"># Returns indexes of all colliding rectangles.</span>
<Surf> = pg.Surface((width, height), flags=<spanclass="hljs-number">0</span>)<spanclass="hljs-comment"># New RGB surface. RGBA if `flags=pg.SRCALPHA`.</span>
<div><h3id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><codeclass="python language-python hljs"><Surf> = pg.display.set_mode((width, height)) <spanclass="hljs-comment"># Returns a display surface.</span>
<Surf> = pg.Surface((width, height)) <spanclass="hljs-comment"># New RGB surface. RGBA if `flags=pg.SRCALPHA`.</span>
<Surf> = pg.image.load(<spanclass="hljs-string">'<path>'</span>) <spanclass="hljs-comment"># Loads the image. Format depends on source.</span>
<Surf> = <Surf>.subsurface(<Rect>) <spanclass="hljs-comment"># Returns a subsurface.</span>
</code></pre></div>
@ -2447,8 +2447,8 @@ rect = pg.Rect(<span class="hljs-number">240</span>, <span class="hljs-number">2
<div><h3id="font">Font</h3><pre><codeclass="python language-python hljs"><Font> = pg.font.SysFont(<spanclass="hljs-string">'<name>'</span>, size) <spanclass="hljs-comment"># Loads the system font or default if missing.</span>
<Font> = pg.font.Font(<spanclass="hljs-string">'<path>'</span>, size) <spanclass="hljs-comment"># Loads the TTF file. Pass None for default.</span>