Biblioteca de fragmentos

Fragmentos probados y listos para copiar en Python, Flask, JavaScript, SQL, HTML, CSS y Bash. Abre cualquiera en el playground.

4 fragmentos

javascript

Deep clone an object

structuredClone copies nested objects, Dates, Maps and Sets correctly.

beginner #objects#data
javascript

Group an array by a key

Build an object of arrays with reduce (works everywhere, unlike Object.groupBy).

beginner #arrays#data#objects
python

Group items by a key

Turn a flat list into a dict of lists with collections.defaultdict.

beginner #collections#dict#data
python

Read and write CSV files

Read rows as dicts and write a filtered copy with csv.DictWriter.

beginner #csv#files#data