pythonlings 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pythonlings/__init__.py +0 -0
- pythonlings/__main__.py +4 -0
- pythonlings/app.py +84 -0
- pythonlings/cli.py +318 -0
- pythonlings/core/__init__.py +0 -0
- pythonlings/core/curriculum.py +106 -0
- pythonlings/core/docs.py +68 -0
- pythonlings/core/exercise.py +33 -0
- pythonlings/core/manifest.py +110 -0
- pythonlings/core/reset.py +43 -0
- pythonlings/core/runner.py +114 -0
- pythonlings/core/solutions.py +17 -0
- pythonlings/core/state.py +86 -0
- pythonlings/curriculum/checks/async/async1.py +4 -0
- pythonlings/curriculum/checks/async/async10.py +4 -0
- pythonlings/curriculum/checks/async/async2.py +4 -0
- pythonlings/curriculum/checks/async/async3.py +4 -0
- pythonlings/curriculum/checks/async/async4.py +4 -0
- pythonlings/curriculum/checks/async/async5.py +4 -0
- pythonlings/curriculum/checks/async/async6.py +4 -0
- pythonlings/curriculum/checks/async/async7.py +4 -0
- pythonlings/curriculum/checks/async/async8.py +2 -0
- pythonlings/curriculum/checks/async/async9.py +4 -0
- pythonlings/curriculum/checks/classes/classes1.py +3 -0
- pythonlings/curriculum/checks/classes/classes10.py +5 -0
- pythonlings/curriculum/checks/classes/classes11.py +5 -0
- pythonlings/curriculum/checks/classes/classes12.py +16 -0
- pythonlings/curriculum/checks/classes/classes2.py +3 -0
- pythonlings/curriculum/checks/classes/classes3.py +4 -0
- pythonlings/curriculum/checks/classes/classes4.py +4 -0
- pythonlings/curriculum/checks/classes/classes5.py +5 -0
- pythonlings/curriculum/checks/classes/classes6.py +4 -0
- pythonlings/curriculum/checks/classes/classes7.py +3 -0
- pythonlings/curriculum/checks/classes/classes8.py +3 -0
- pythonlings/curriculum/checks/classes/classes9.py +4 -0
- pythonlings/curriculum/checks/collections/collections1.py +4 -0
- pythonlings/curriculum/checks/collections/collections10.py +15 -0
- pythonlings/curriculum/checks/collections/collections2.py +4 -0
- pythonlings/curriculum/checks/collections/collections3.py +5 -0
- pythonlings/curriculum/checks/collections/collections4.py +4 -0
- pythonlings/curriculum/checks/collections/collections5.py +5 -0
- pythonlings/curriculum/checks/collections/collections6.py +6 -0
- pythonlings/curriculum/checks/collections/collections7.py +4 -0
- pythonlings/curriculum/checks/collections/collections8.py +5 -0
- pythonlings/curriculum/checks/collections/collections9.py +9 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions1.py +3 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions10.py +5 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions2.py +3 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions3.py +3 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions4.py +6 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions5.py +3 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions6.py +3 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions7.py +4 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions8.py +5 -0
- pythonlings/curriculum/checks/comprehensions/comprehensions9.py +3 -0
- pythonlings/curriculum/checks/conditionals/conditionals1.py +2 -0
- pythonlings/curriculum/checks/conditionals/conditionals10.py +10 -0
- pythonlings/curriculum/checks/conditionals/conditionals2.py +5 -0
- pythonlings/curriculum/checks/conditionals/conditionals3.py +9 -0
- pythonlings/curriculum/checks/conditionals/conditionals4.py +7 -0
- pythonlings/curriculum/checks/conditionals/conditionals5.py +9 -0
- pythonlings/curriculum/checks/conditionals/conditionals6.py +7 -0
- pythonlings/curriculum/checks/conditionals/conditionals7.py +7 -0
- pythonlings/curriculum/checks/conditionals/conditionals8.py +9 -0
- pythonlings/curriculum/checks/conditionals/conditionals9.py +7 -0
- pythonlings/curriculum/checks/context_managers/context_managers1.py +15 -0
- pythonlings/curriculum/checks/context_managers/context_managers2.py +10 -0
- pythonlings/curriculum/checks/context_managers/context_managers3.py +2 -0
- pythonlings/curriculum/checks/context_managers/context_managers4.py +3 -0
- pythonlings/curriculum/checks/context_managers/context_managers5.py +5 -0
- pythonlings/curriculum/checks/context_managers/context_managers6.py +4 -0
- pythonlings/curriculum/checks/context_managers/context_managers7.py +16 -0
- pythonlings/curriculum/checks/context_managers/context_managers8.py +15 -0
- pythonlings/curriculum/checks/dataclasses/dataclasses1.py +3 -0
- pythonlings/curriculum/checks/dataclasses/dataclasses2.py +5 -0
- pythonlings/curriculum/checks/dataclasses/dataclasses3.py +4 -0
- pythonlings/curriculum/checks/dataclasses/dataclasses4.py +3 -0
- pythonlings/curriculum/checks/dataclasses/dataclasses5.py +9 -0
- pythonlings/curriculum/checks/dataclasses/dataclasses6.py +6 -0
- pythonlings/curriculum/checks/dataclasses/dataclasses7.py +6 -0
- pythonlings/curriculum/checks/dataclasses/dataclasses8.py +5 -0
- pythonlings/curriculum/checks/datetime/datetime1.py +4 -0
- pythonlings/curriculum/checks/datetime/datetime2.py +4 -0
- pythonlings/curriculum/checks/datetime/datetime3.py +6 -0
- pythonlings/curriculum/checks/datetime/datetime4.py +2 -0
- pythonlings/curriculum/checks/datetime/datetime5.py +2 -0
- pythonlings/curriculum/checks/datetime/datetime6.py +2 -0
- pythonlings/curriculum/checks/datetime/datetime7.py +2 -0
- pythonlings/curriculum/checks/datetime/datetime8.py +5 -0
- pythonlings/curriculum/checks/decorators/decorators1.py +8 -0
- pythonlings/curriculum/checks/decorators/decorators10.py +12 -0
- pythonlings/curriculum/checks/decorators/decorators2.py +5 -0
- pythonlings/curriculum/checks/decorators/decorators3.py +4 -0
- pythonlings/curriculum/checks/decorators/decorators4.py +7 -0
- pythonlings/curriculum/checks/decorators/decorators5.py +5 -0
- pythonlings/curriculum/checks/decorators/decorators6.py +8 -0
- pythonlings/curriculum/checks/decorators/decorators7.py +12 -0
- pythonlings/curriculum/checks/decorators/decorators8.py +20 -0
- pythonlings/curriculum/checks/decorators/decorators9.py +4 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries1.py +3 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries10.py +5 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries2.py +2 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries3.py +5 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries4.py +5 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries5.py +11 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries6.py +4 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries7.py +5 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries8.py +4 -0
- pythonlings/curriculum/checks/dictionaries/dictionaries9.py +4 -0
- pythonlings/curriculum/checks/enums/enums1.py +4 -0
- pythonlings/curriculum/checks/enums/enums2.py +3 -0
- pythonlings/curriculum/checks/enums/enums3.py +3 -0
- pythonlings/curriculum/checks/enums/enums4.py +2 -0
- pythonlings/curriculum/checks/enums/enums5.py +4 -0
- pythonlings/curriculum/checks/enums/enums6.py +3 -0
- pythonlings/curriculum/checks/exceptions/exceptions1.py +4 -0
- pythonlings/curriculum/checks/exceptions/exceptions10.py +39 -0
- pythonlings/curriculum/checks/exceptions/exceptions2.py +5 -0
- pythonlings/curriculum/checks/exceptions/exceptions3.py +8 -0
- pythonlings/curriculum/checks/exceptions/exceptions4.py +5 -0
- pythonlings/curriculum/checks/exceptions/exceptions5.py +10 -0
- pythonlings/curriculum/checks/exceptions/exceptions6.py +17 -0
- pythonlings/curriculum/checks/exceptions/exceptions7.py +15 -0
- pythonlings/curriculum/checks/exceptions/exceptions8.py +6 -0
- pythonlings/curriculum/checks/exceptions/exceptions9.py +16 -0
- pythonlings/curriculum/checks/file_io/file_io1.py +15 -0
- pythonlings/curriculum/checks/file_io/file_io10.py +16 -0
- pythonlings/curriculum/checks/file_io/file_io2.py +10 -0
- pythonlings/curriculum/checks/file_io/file_io3.py +15 -0
- pythonlings/curriculum/checks/file_io/file_io4.py +14 -0
- pythonlings/curriculum/checks/file_io/file_io5.py +15 -0
- pythonlings/curriculum/checks/file_io/file_io6.py +10 -0
- pythonlings/curriculum/checks/file_io/file_io7.py +15 -0
- pythonlings/curriculum/checks/file_io/file_io8.py +12 -0
- pythonlings/curriculum/checks/file_io/file_io9.py +10 -0
- pythonlings/curriculum/checks/functional/functional1.py +4 -0
- pythonlings/curriculum/checks/functional/functional10.py +7 -0
- pythonlings/curriculum/checks/functional/functional2.py +5 -0
- pythonlings/curriculum/checks/functional/functional3.py +3 -0
- pythonlings/curriculum/checks/functional/functional4.py +4 -0
- pythonlings/curriculum/checks/functional/functional5.py +6 -0
- pythonlings/curriculum/checks/functional/functional6.py +8 -0
- pythonlings/curriculum/checks/functional/functional7.py +8 -0
- pythonlings/curriculum/checks/functional/functional8.py +7 -0
- pythonlings/curriculum/checks/functional/functional9.py +8 -0
- pythonlings/curriculum/checks/functions/functions1.py +9 -0
- pythonlings/curriculum/checks/functions/functions10.py +12 -0
- pythonlings/curriculum/checks/functions/functions2.py +4 -0
- pythonlings/curriculum/checks/functions/functions3.py +6 -0
- pythonlings/curriculum/checks/functions/functions4.py +6 -0
- pythonlings/curriculum/checks/functions/functions5.py +6 -0
- pythonlings/curriculum/checks/functions/functions6.py +8 -0
- pythonlings/curriculum/checks/functions/functions7.py +7 -0
- pythonlings/curriculum/checks/functions/functions8.py +6 -0
- pythonlings/curriculum/checks/functions/functions9.py +7 -0
- pythonlings/curriculum/checks/generators/generators1.py +4 -0
- pythonlings/curriculum/checks/generators/generators10.py +7 -0
- pythonlings/curriculum/checks/generators/generators2.py +3 -0
- pythonlings/curriculum/checks/generators/generators3.py +4 -0
- pythonlings/curriculum/checks/generators/generators4.py +9 -0
- pythonlings/curriculum/checks/generators/generators5.py +10 -0
- pythonlings/curriculum/checks/generators/generators6.py +8 -0
- pythonlings/curriculum/checks/generators/generators7.py +11 -0
- pythonlings/curriculum/checks/generators/generators8.py +8 -0
- pythonlings/curriculum/checks/generators/generators9.py +13 -0
- pythonlings/curriculum/checks/itertools/itertools1.py +2 -0
- pythonlings/curriculum/checks/itertools/itertools2.py +2 -0
- pythonlings/curriculum/checks/itertools/itertools3.py +2 -0
- pythonlings/curriculum/checks/itertools/itertools4.py +2 -0
- pythonlings/curriculum/checks/itertools/itertools5.py +2 -0
- pythonlings/curriculum/checks/itertools/itertools6.py +2 -0
- pythonlings/curriculum/checks/itertools/itertools7.py +2 -0
- pythonlings/curriculum/checks/itertools/itertools8.py +3 -0
- pythonlings/curriculum/checks/json/json1.py +3 -0
- pythonlings/curriculum/checks/json/json2.py +2 -0
- pythonlings/curriculum/checks/json/json3.py +2 -0
- pythonlings/curriculum/checks/json/json4.py +2 -0
- pythonlings/curriculum/checks/json/json5.py +2 -0
- pythonlings/curriculum/checks/json/json6.py +2 -0
- pythonlings/curriculum/checks/json/json7.py +3 -0
- pythonlings/curriculum/checks/json/json8.py +4 -0
- pythonlings/curriculum/checks/lists/lists1.py +2 -0
- pythonlings/curriculum/checks/lists/lists10.py +5 -0
- pythonlings/curriculum/checks/lists/lists2.py +3 -0
- pythonlings/curriculum/checks/lists/lists3.py +4 -0
- pythonlings/curriculum/checks/lists/lists4.py +3 -0
- pythonlings/curriculum/checks/lists/lists5.py +4 -0
- pythonlings/curriculum/checks/lists/lists6.py +3 -0
- pythonlings/curriculum/checks/lists/lists7.py +4 -0
- pythonlings/curriculum/checks/lists/lists8.py +7 -0
- pythonlings/curriculum/checks/lists/lists9.py +4 -0
- pythonlings/curriculum/checks/loops/loops1.py +2 -0
- pythonlings/curriculum/checks/loops/loops10.py +6 -0
- pythonlings/curriculum/checks/loops/loops2.py +2 -0
- pythonlings/curriculum/checks/loops/loops3.py +2 -0
- pythonlings/curriculum/checks/loops/loops4.py +3 -0
- pythonlings/curriculum/checks/loops/loops5.py +2 -0
- pythonlings/curriculum/checks/loops/loops6.py +2 -0
- pythonlings/curriculum/checks/loops/loops7.py +2 -0
- pythonlings/curriculum/checks/loops/loops8.py +2 -0
- pythonlings/curriculum/checks/loops/loops9.py +3 -0
- pythonlings/curriculum/checks/modules/modules1.py +2 -0
- pythonlings/curriculum/checks/modules/modules2.py +2 -0
- pythonlings/curriculum/checks/modules/modules3.py +5 -0
- pythonlings/curriculum/checks/modules/modules4.py +8 -0
- pythonlings/curriculum/checks/modules/modules5.py +7 -0
- pythonlings/curriculum/checks/modules/modules6.py +4 -0
- pythonlings/curriculum/checks/modules/modules7.py +4 -0
- pythonlings/curriculum/checks/modules/modules8.py +15 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced1.py +4 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced10.py +3 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced11.py +3 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced12.py +4 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced2.py +4 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced3.py +3 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced4.py +3 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced5.py +3 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced6.py +2 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced7.py +3 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced8.py +3 -0
- pythonlings/curriculum/checks/oop_advanced/oop_advanced9.py +4 -0
- pythonlings/curriculum/checks/pathlib/pathlib1.py +5 -0
- pythonlings/curriculum/checks/pathlib/pathlib2.py +4 -0
- pythonlings/curriculum/checks/pathlib/pathlib3.py +6 -0
- pythonlings/curriculum/checks/pathlib/pathlib4.py +4 -0
- pythonlings/curriculum/checks/pathlib/pathlib5.py +4 -0
- pythonlings/curriculum/checks/pathlib/pathlib6.py +5 -0
- pythonlings/curriculum/checks/recursion/recursion1.py +5 -0
- pythonlings/curriculum/checks/recursion/recursion2.py +5 -0
- pythonlings/curriculum/checks/recursion/recursion3.py +6 -0
- pythonlings/curriculum/checks/recursion/recursion4.py +6 -0
- pythonlings/curriculum/checks/recursion/recursion5.py +7 -0
- pythonlings/curriculum/checks/recursion/recursion6.py +7 -0
- pythonlings/curriculum/checks/recursion/recursion7.py +7 -0
- pythonlings/curriculum/checks/recursion/recursion8.py +15 -0
- pythonlings/curriculum/checks/regex/regex1.py +3 -0
- pythonlings/curriculum/checks/regex/regex10.py +17 -0
- pythonlings/curriculum/checks/regex/regex2.py +3 -0
- pythonlings/curriculum/checks/regex/regex3.py +2 -0
- pythonlings/curriculum/checks/regex/regex4.py +4 -0
- pythonlings/curriculum/checks/regex/regex5.py +4 -0
- pythonlings/curriculum/checks/regex/regex6.py +6 -0
- pythonlings/curriculum/checks/regex/regex7.py +5 -0
- pythonlings/curriculum/checks/regex/regex8.py +6 -0
- pythonlings/curriculum/checks/regex/regex9.py +8 -0
- pythonlings/curriculum/checks/sets/sets1.py +3 -0
- pythonlings/curriculum/checks/sets/sets10.py +15 -0
- pythonlings/curriculum/checks/sets/sets2.py +5 -0
- pythonlings/curriculum/checks/sets/sets3.py +5 -0
- pythonlings/curriculum/checks/sets/sets4.py +3 -0
- pythonlings/curriculum/checks/sets/sets5.py +3 -0
- pythonlings/curriculum/checks/sets/sets6.py +3 -0
- pythonlings/curriculum/checks/sets/sets7.py +5 -0
- pythonlings/curriculum/checks/sets/sets8.py +5 -0
- pythonlings/curriculum/checks/sets/sets9.py +3 -0
- pythonlings/curriculum/checks/strings/strings1.py +3 -0
- pythonlings/curriculum/checks/strings/strings10.py +5 -0
- pythonlings/curriculum/checks/strings/strings2.py +3 -0
- pythonlings/curriculum/checks/strings/strings3.py +3 -0
- pythonlings/curriculum/checks/strings/strings4.py +2 -0
- pythonlings/curriculum/checks/strings/strings5.py +4 -0
- pythonlings/curriculum/checks/strings/strings6.py +3 -0
- pythonlings/curriculum/checks/strings/strings7.py +3 -0
- pythonlings/curriculum/checks/strings/strings8.py +3 -0
- pythonlings/curriculum/checks/strings/strings9.py +3 -0
- pythonlings/curriculum/checks/testing/testing1.py +2 -0
- pythonlings/curriculum/checks/testing/testing10.py +9 -0
- pythonlings/curriculum/checks/testing/testing11.py +7 -0
- pythonlings/curriculum/checks/testing/testing12.py +19 -0
- pythonlings/curriculum/checks/testing/testing2.py +2 -0
- pythonlings/curriculum/checks/testing/testing3.py +12 -0
- pythonlings/curriculum/checks/testing/testing4.py +6 -0
- pythonlings/curriculum/checks/testing/testing5.py +6 -0
- pythonlings/curriculum/checks/testing/testing6.py +14 -0
- pythonlings/curriculum/checks/testing/testing7.py +14 -0
- pythonlings/curriculum/checks/testing/testing8.py +27 -0
- pythonlings/curriculum/checks/testing/testing9.py +14 -0
- pythonlings/curriculum/checks/tuples/tuples1.py +3 -0
- pythonlings/curriculum/checks/tuples/tuples10.py +6 -0
- pythonlings/curriculum/checks/tuples/tuples2.py +3 -0
- pythonlings/curriculum/checks/tuples/tuples3.py +4 -0
- pythonlings/curriculum/checks/tuples/tuples4.py +3 -0
- pythonlings/curriculum/checks/tuples/tuples5.py +4 -0
- pythonlings/curriculum/checks/tuples/tuples6.py +5 -0
- pythonlings/curriculum/checks/tuples/tuples7.py +3 -0
- pythonlings/curriculum/checks/tuples/tuples8.py +4 -0
- pythonlings/curriculum/checks/tuples/tuples9.py +5 -0
- pythonlings/curriculum/checks/type_hints/type_hints1.py +3 -0
- pythonlings/curriculum/checks/type_hints/type_hints2.py +5 -0
- pythonlings/curriculum/checks/type_hints/type_hints3.py +5 -0
- pythonlings/curriculum/checks/type_hints/type_hints4.py +5 -0
- pythonlings/curriculum/checks/type_hints/type_hints5.py +6 -0
- pythonlings/curriculum/checks/type_hints/type_hints6.py +7 -0
- pythonlings/curriculum/checks/type_hints/type_hints7.py +9 -0
- pythonlings/curriculum/checks/type_hints/type_hints8.py +9 -0
- pythonlings/curriculum/checks/variables/variables1.py +7 -0
- pythonlings/curriculum/checks/variables/variables10.py +4 -0
- pythonlings/curriculum/checks/variables/variables2.py +19 -0
- pythonlings/curriculum/checks/variables/variables3.py +4 -0
- pythonlings/curriculum/checks/variables/variables4.py +2 -0
- pythonlings/curriculum/checks/variables/variables5.py +2 -0
- pythonlings/curriculum/checks/variables/variables6.py +4 -0
- pythonlings/curriculum/checks/variables/variables7.py +3 -0
- pythonlings/curriculum/checks/variables/variables8.py +4 -0
- pythonlings/curriculum/checks/variables/variables9.py +3 -0
- pythonlings/curriculum/exercises/async/async1.py +7 -0
- pythonlings/curriculum/exercises/async/async10.py +14 -0
- pythonlings/curriculum/exercises/async/async2.py +10 -0
- pythonlings/curriculum/exercises/async/async3.py +10 -0
- pythonlings/curriculum/exercises/async/async4.py +15 -0
- pythonlings/curriculum/exercises/async/async5.py +13 -0
- pythonlings/curriculum/exercises/async/async6.py +14 -0
- pythonlings/curriculum/exercises/async/async7.py +13 -0
- pythonlings/curriculum/exercises/async/async8.py +11 -0
- pythonlings/curriculum/exercises/async/async9.py +13 -0
- pythonlings/curriculum/exercises/classes/classes1.py +13 -0
- pythonlings/curriculum/exercises/classes/classes10.py +22 -0
- pythonlings/curriculum/exercises/classes/classes11.py +24 -0
- pythonlings/curriculum/exercises/classes/classes12.py +33 -0
- pythonlings/curriculum/exercises/classes/classes2.py +13 -0
- pythonlings/curriculum/exercises/classes/classes3.py +13 -0
- pythonlings/curriculum/exercises/classes/classes4.py +16 -0
- pythonlings/curriculum/exercises/classes/classes5.py +18 -0
- pythonlings/curriculum/exercises/classes/classes6.py +15 -0
- pythonlings/curriculum/exercises/classes/classes7.py +18 -0
- pythonlings/curriculum/exercises/classes/classes8.py +14 -0
- pythonlings/curriculum/exercises/classes/classes9.py +18 -0
- pythonlings/curriculum/exercises/collections/collections1.py +11 -0
- pythonlings/curriculum/exercises/collections/collections10.py +37 -0
- pythonlings/curriculum/exercises/collections/collections2.py +18 -0
- pythonlings/curriculum/exercises/collections/collections3.py +17 -0
- pythonlings/curriculum/exercises/collections/collections4.py +26 -0
- pythonlings/curriculum/exercises/collections/collections5.py +14 -0
- pythonlings/curriculum/exercises/collections/collections6.py +18 -0
- pythonlings/curriculum/exercises/collections/collections7.py +20 -0
- pythonlings/curriculum/exercises/collections/collections8.py +23 -0
- pythonlings/curriculum/exercises/collections/collections9.py +21 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions1.py +10 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions10.py +15 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions2.py +12 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions3.py +12 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions4.py +14 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions5.py +12 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions6.py +12 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions7.py +12 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions8.py +15 -0
- pythonlings/curriculum/exercises/comprehensions/comprehensions9.py +13 -0
- pythonlings/curriculum/exercises/conditionals/conditionals1.py +15 -0
- pythonlings/curriculum/exercises/conditionals/conditionals10.py +18 -0
- pythonlings/curriculum/exercises/conditionals/conditionals2.py +13 -0
- pythonlings/curriculum/exercises/conditionals/conditionals3.py +18 -0
- pythonlings/curriculum/exercises/conditionals/conditionals4.py +20 -0
- pythonlings/curriculum/exercises/conditionals/conditionals5.py +17 -0
- pythonlings/curriculum/exercises/conditionals/conditionals6.py +15 -0
- pythonlings/curriculum/exercises/conditionals/conditionals7.py +18 -0
- pythonlings/curriculum/exercises/conditionals/conditionals8.py +20 -0
- pythonlings/curriculum/exercises/conditionals/conditionals9.py +12 -0
- pythonlings/curriculum/exercises/context_managers/context_managers1.py +18 -0
- pythonlings/curriculum/exercises/context_managers/context_managers2.py +19 -0
- pythonlings/curriculum/exercises/context_managers/context_managers3.py +24 -0
- pythonlings/curriculum/exercises/context_managers/context_managers4.py +30 -0
- pythonlings/curriculum/exercises/context_managers/context_managers5.py +30 -0
- pythonlings/curriculum/exercises/context_managers/context_managers6.py +26 -0
- pythonlings/curriculum/exercises/context_managers/context_managers7.py +30 -0
- pythonlings/curriculum/exercises/context_managers/context_managers8.py +45 -0
- pythonlings/curriculum/exercises/dataclasses/dataclasses1.py +14 -0
- pythonlings/curriculum/exercises/dataclasses/dataclasses2.py +23 -0
- pythonlings/curriculum/exercises/dataclasses/dataclasses3.py +21 -0
- pythonlings/curriculum/exercises/dataclasses/dataclasses4.py +25 -0
- pythonlings/curriculum/exercises/dataclasses/dataclasses5.py +25 -0
- pythonlings/curriculum/exercises/dataclasses/dataclasses6.py +21 -0
- pythonlings/curriculum/exercises/dataclasses/dataclasses7.py +27 -0
- pythonlings/curriculum/exercises/dataclasses/dataclasses8.py +30 -0
- pythonlings/curriculum/exercises/datetime/datetime1.py +8 -0
- pythonlings/curriculum/exercises/datetime/datetime2.py +9 -0
- pythonlings/curriculum/exercises/datetime/datetime3.py +9 -0
- pythonlings/curriculum/exercises/datetime/datetime4.py +9 -0
- pythonlings/curriculum/exercises/datetime/datetime5.py +10 -0
- pythonlings/curriculum/exercises/datetime/datetime6.py +10 -0
- pythonlings/curriculum/exercises/datetime/datetime7.py +10 -0
- pythonlings/curriculum/exercises/datetime/datetime8.py +11 -0
- pythonlings/curriculum/exercises/decorators/decorators1.py +19 -0
- pythonlings/curriculum/exercises/decorators/decorators10.py +32 -0
- pythonlings/curriculum/exercises/decorators/decorators2.py +22 -0
- pythonlings/curriculum/exercises/decorators/decorators3.py +18 -0
- pythonlings/curriculum/exercises/decorators/decorators4.py +24 -0
- pythonlings/curriculum/exercises/decorators/decorators5.py +25 -0
- pythonlings/curriculum/exercises/decorators/decorators6.py +19 -0
- pythonlings/curriculum/exercises/decorators/decorators7.py +25 -0
- pythonlings/curriculum/exercises/decorators/decorators8.py +25 -0
- pythonlings/curriculum/exercises/decorators/decorators9.py +26 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries1.py +6 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries10.py +17 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries2.py +9 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries3.py +16 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries4.py +15 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries5.py +15 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries6.py +18 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries7.py +17 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries8.py +17 -0
- pythonlings/curriculum/exercises/dictionaries/dictionaries9.py +25 -0
- pythonlings/curriculum/exercises/enums/enums1.py +12 -0
- pythonlings/curriculum/exercises/enums/enums2.py +11 -0
- pythonlings/curriculum/exercises/enums/enums3.py +14 -0
- pythonlings/curriculum/exercises/enums/enums4.py +13 -0
- pythonlings/curriculum/exercises/enums/enums5.py +14 -0
- pythonlings/curriculum/exercises/enums/enums6.py +15 -0
- pythonlings/curriculum/exercises/exceptions/exceptions1.py +15 -0
- pythonlings/curriculum/exercises/exceptions/exceptions10.py +19 -0
- pythonlings/curriculum/exercises/exceptions/exceptions2.py +12 -0
- pythonlings/curriculum/exercises/exceptions/exceptions3.py +13 -0
- pythonlings/curriculum/exercises/exceptions/exceptions4.py +17 -0
- pythonlings/curriculum/exercises/exceptions/exceptions5.py +20 -0
- pythonlings/curriculum/exercises/exceptions/exceptions6.py +13 -0
- pythonlings/curriculum/exercises/exceptions/exceptions7.py +15 -0
- pythonlings/curriculum/exercises/exceptions/exceptions8.py +17 -0
- pythonlings/curriculum/exercises/exceptions/exceptions9.py +20 -0
- pythonlings/curriculum/exercises/file_io/file_io1.py +18 -0
- pythonlings/curriculum/exercises/file_io/file_io10.py +25 -0
- pythonlings/curriculum/exercises/file_io/file_io2.py +16 -0
- pythonlings/curriculum/exercises/file_io/file_io3.py +18 -0
- pythonlings/curriculum/exercises/file_io/file_io4.py +21 -0
- pythonlings/curriculum/exercises/file_io/file_io5.py +19 -0
- pythonlings/curriculum/exercises/file_io/file_io6.py +22 -0
- pythonlings/curriculum/exercises/file_io/file_io7.py +20 -0
- pythonlings/curriculum/exercises/file_io/file_io8.py +18 -0
- pythonlings/curriculum/exercises/file_io/file_io9.py +19 -0
- pythonlings/curriculum/exercises/functional/functional1.py +7 -0
- pythonlings/curriculum/exercises/functional/functional10.py +19 -0
- pythonlings/curriculum/exercises/functional/functional2.py +8 -0
- pythonlings/curriculum/exercises/functional/functional3.py +11 -0
- pythonlings/curriculum/exercises/functional/functional4.py +11 -0
- pythonlings/curriculum/exercises/functional/functional5.py +11 -0
- pythonlings/curriculum/exercises/functional/functional6.py +14 -0
- pythonlings/curriculum/exercises/functional/functional7.py +12 -0
- pythonlings/curriculum/exercises/functional/functional8.py +13 -0
- pythonlings/curriculum/exercises/functional/functional9.py +15 -0
- pythonlings/curriculum/exercises/functions/functions1.py +8 -0
- pythonlings/curriculum/exercises/functions/functions10.py +19 -0
- pythonlings/curriculum/exercises/functions/functions2.py +9 -0
- pythonlings/curriculum/exercises/functions/functions3.py +8 -0
- pythonlings/curriculum/exercises/functions/functions4.py +8 -0
- pythonlings/curriculum/exercises/functions/functions5.py +11 -0
- pythonlings/curriculum/exercises/functions/functions6.py +16 -0
- pythonlings/curriculum/exercises/functions/functions7.py +11 -0
- pythonlings/curriculum/exercises/functions/functions8.py +10 -0
- pythonlings/curriculum/exercises/functions/functions9.py +16 -0
- pythonlings/curriculum/exercises/generators/generators1.py +13 -0
- pythonlings/curriculum/exercises/generators/generators10.py +16 -0
- pythonlings/curriculum/exercises/generators/generators2.py +17 -0
- pythonlings/curriculum/exercises/generators/generators3.py +19 -0
- pythonlings/curriculum/exercises/generators/generators4.py +12 -0
- pythonlings/curriculum/exercises/generators/generators5.py +24 -0
- pythonlings/curriculum/exercises/generators/generators6.py +20 -0
- pythonlings/curriculum/exercises/generators/generators7.py +14 -0
- pythonlings/curriculum/exercises/generators/generators8.py +17 -0
- pythonlings/curriculum/exercises/generators/generators9.py +26 -0
- pythonlings/curriculum/exercises/itertools/itertools1.py +10 -0
- pythonlings/curriculum/exercises/itertools/itertools2.py +8 -0
- pythonlings/curriculum/exercises/itertools/itertools3.py +10 -0
- pythonlings/curriculum/exercises/itertools/itertools4.py +12 -0
- pythonlings/curriculum/exercises/itertools/itertools5.py +9 -0
- pythonlings/curriculum/exercises/itertools/itertools6.py +9 -0
- pythonlings/curriculum/exercises/itertools/itertools7.py +10 -0
- pythonlings/curriculum/exercises/itertools/itertools8.py +18 -0
- pythonlings/curriculum/exercises/json/json1.py +10 -0
- pythonlings/curriculum/exercises/json/json2.py +9 -0
- pythonlings/curriculum/exercises/json/json3.py +10 -0
- pythonlings/curriculum/exercises/json/json4.py +13 -0
- pythonlings/curriculum/exercises/json/json5.py +9 -0
- pythonlings/curriculum/exercises/json/json6.py +10 -0
- pythonlings/curriculum/exercises/json/json7.py +10 -0
- pythonlings/curriculum/exercises/json/json8.py +12 -0
- pythonlings/curriculum/exercises/lists/lists1.py +7 -0
- pythonlings/curriculum/exercises/lists/lists10.py +28 -0
- pythonlings/curriculum/exercises/lists/lists2.py +13 -0
- pythonlings/curriculum/exercises/lists/lists3.py +16 -0
- pythonlings/curriculum/exercises/lists/lists4.py +16 -0
- pythonlings/curriculum/exercises/lists/lists5.py +16 -0
- pythonlings/curriculum/exercises/lists/lists6.py +15 -0
- pythonlings/curriculum/exercises/lists/lists7.py +13 -0
- pythonlings/curriculum/exercises/lists/lists8.py +15 -0
- pythonlings/curriculum/exercises/lists/lists9.py +19 -0
- pythonlings/curriculum/exercises/loops/loops1.py +8 -0
- pythonlings/curriculum/exercises/loops/loops10.py +22 -0
- pythonlings/curriculum/exercises/loops/loops2.py +10 -0
- pythonlings/curriculum/exercises/loops/loops3.py +10 -0
- pythonlings/curriculum/exercises/loops/loops4.py +12 -0
- pythonlings/curriculum/exercises/loops/loops5.py +13 -0
- pythonlings/curriculum/exercises/loops/loops6.py +10 -0
- pythonlings/curriculum/exercises/loops/loops7.py +13 -0
- pythonlings/curriculum/exercises/loops/loops8.py +11 -0
- pythonlings/curriculum/exercises/loops/loops9.py +11 -0
- pythonlings/curriculum/exercises/modules/modules1.py +10 -0
- pythonlings/curriculum/exercises/modules/modules2.py +10 -0
- pythonlings/curriculum/exercises/modules/modules3.py +13 -0
- pythonlings/curriculum/exercises/modules/modules4.py +18 -0
- pythonlings/curriculum/exercises/modules/modules5.py +17 -0
- pythonlings/curriculum/exercises/modules/modules6.py +12 -0
- pythonlings/curriculum/exercises/modules/modules7.py +16 -0
- pythonlings/curriculum/exercises/modules/modules8.py +23 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced1.py +11 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced10.py +18 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced11.py +13 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced12.py +12 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced2.py +13 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced3.py +22 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced4.py +12 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced5.py +11 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced6.py +12 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced7.py +14 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced8.py +14 -0
- pythonlings/curriculum/exercises/oop_advanced/oop_advanced9.py +9 -0
- pythonlings/curriculum/exercises/pathlib/pathlib1.py +9 -0
- pythonlings/curriculum/exercises/pathlib/pathlib2.py +9 -0
- pythonlings/curriculum/exercises/pathlib/pathlib3.py +11 -0
- pythonlings/curriculum/exercises/pathlib/pathlib4.py +9 -0
- pythonlings/curriculum/exercises/pathlib/pathlib5.py +9 -0
- pythonlings/curriculum/exercises/pathlib/pathlib6.py +10 -0
- pythonlings/curriculum/exercises/recursion/recursion1.py +12 -0
- pythonlings/curriculum/exercises/recursion/recursion2.py +12 -0
- pythonlings/curriculum/exercises/recursion/recursion3.py +12 -0
- pythonlings/curriculum/exercises/recursion/recursion4.py +12 -0
- pythonlings/curriculum/exercises/recursion/recursion5.py +14 -0
- pythonlings/curriculum/exercises/recursion/recursion6.py +13 -0
- pythonlings/curriculum/exercises/recursion/recursion7.py +20 -0
- pythonlings/curriculum/exercises/recursion/recursion8.py +27 -0
- pythonlings/curriculum/exercises/regex/regex1.py +16 -0
- pythonlings/curriculum/exercises/regex/regex10.py +31 -0
- pythonlings/curriculum/exercises/regex/regex2.py +16 -0
- pythonlings/curriculum/exercises/regex/regex3.py +16 -0
- pythonlings/curriculum/exercises/regex/regex4.py +19 -0
- pythonlings/curriculum/exercises/regex/regex5.py +19 -0
- pythonlings/curriculum/exercises/regex/regex6.py +23 -0
- pythonlings/curriculum/exercises/regex/regex7.py +24 -0
- pythonlings/curriculum/exercises/regex/regex8.py +19 -0
- pythonlings/curriculum/exercises/regex/regex9.py +22 -0
- pythonlings/curriculum/exercises/sets/sets1.py +6 -0
- pythonlings/curriculum/exercises/sets/sets10.py +21 -0
- pythonlings/curriculum/exercises/sets/sets2.py +12 -0
- pythonlings/curriculum/exercises/sets/sets3.py +15 -0
- pythonlings/curriculum/exercises/sets/sets4.py +14 -0
- pythonlings/curriculum/exercises/sets/sets5.py +14 -0
- pythonlings/curriculum/exercises/sets/sets6.py +14 -0
- pythonlings/curriculum/exercises/sets/sets7.py +16 -0
- pythonlings/curriculum/exercises/sets/sets8.py +16 -0
- pythonlings/curriculum/exercises/sets/sets9.py +15 -0
- pythonlings/curriculum/exercises/strings/strings1.py +6 -0
- pythonlings/curriculum/exercises/strings/strings10.py +11 -0
- pythonlings/curriculum/exercises/strings/strings2.py +9 -0
- pythonlings/curriculum/exercises/strings/strings3.py +9 -0
- pythonlings/curriculum/exercises/strings/strings4.py +8 -0
- pythonlings/curriculum/exercises/strings/strings5.py +10 -0
- pythonlings/curriculum/exercises/strings/strings6.py +10 -0
- pythonlings/curriculum/exercises/strings/strings7.py +10 -0
- pythonlings/curriculum/exercises/strings/strings8.py +9 -0
- pythonlings/curriculum/exercises/strings/strings9.py +10 -0
- pythonlings/curriculum/exercises/testing/testing1.py +16 -0
- pythonlings/curriculum/exercises/testing/testing10.py +21 -0
- pythonlings/curriculum/exercises/testing/testing11.py +27 -0
- pythonlings/curriculum/exercises/testing/testing12.py +51 -0
- pythonlings/curriculum/exercises/testing/testing2.py +15 -0
- pythonlings/curriculum/exercises/testing/testing3.py +19 -0
- pythonlings/curriculum/exercises/testing/testing4.py +19 -0
- pythonlings/curriculum/exercises/testing/testing5.py +18 -0
- pythonlings/curriculum/exercises/testing/testing6.py +27 -0
- pythonlings/curriculum/exercises/testing/testing7.py +27 -0
- pythonlings/curriculum/exercises/testing/testing8.py +29 -0
- pythonlings/curriculum/exercises/testing/testing9.py +30 -0
- pythonlings/curriculum/exercises/tuples/tuples1.py +7 -0
- pythonlings/curriculum/exercises/tuples/tuples10.py +26 -0
- pythonlings/curriculum/exercises/tuples/tuples2.py +11 -0
- pythonlings/curriculum/exercises/tuples/tuples3.py +9 -0
- pythonlings/curriculum/exercises/tuples/tuples4.py +8 -0
- pythonlings/curriculum/exercises/tuples/tuples5.py +12 -0
- pythonlings/curriculum/exercises/tuples/tuples6.py +15 -0
- pythonlings/curriculum/exercises/tuples/tuples7.py +14 -0
- pythonlings/curriculum/exercises/tuples/tuples8.py +13 -0
- pythonlings/curriculum/exercises/tuples/tuples9.py +18 -0
- pythonlings/curriculum/exercises/type_hints/type_hints1.py +9 -0
- pythonlings/curriculum/exercises/type_hints/type_hints2.py +13 -0
- pythonlings/curriculum/exercises/type_hints/type_hints3.py +13 -0
- pythonlings/curriculum/exercises/type_hints/type_hints4.py +21 -0
- pythonlings/curriculum/exercises/type_hints/type_hints5.py +15 -0
- pythonlings/curriculum/exercises/type_hints/type_hints6.py +16 -0
- pythonlings/curriculum/exercises/type_hints/type_hints7.py +19 -0
- pythonlings/curriculum/exercises/type_hints/type_hints8.py +27 -0
- pythonlings/curriculum/exercises/variables/variables1.py +10 -0
- pythonlings/curriculum/exercises/variables/variables10.py +14 -0
- pythonlings/curriculum/exercises/variables/variables2.py +11 -0
- pythonlings/curriculum/exercises/variables/variables3.py +11 -0
- pythonlings/curriculum/exercises/variables/variables4.py +9 -0
- pythonlings/curriculum/exercises/variables/variables5.py +11 -0
- pythonlings/curriculum/exercises/variables/variables6.py +9 -0
- pythonlings/curriculum/exercises/variables/variables7.py +10 -0
- pythonlings/curriculum/exercises/variables/variables8.py +12 -0
- pythonlings/curriculum/exercises/variables/variables9.py +10 -0
- pythonlings/curriculum/info.toml +1755 -0
- pythonlings/curriculum/solutions/.keep +1 -0
- pythonlings/curriculum/solutions/_answers.py +1654 -0
- pythonlings/curriculum/solutions/async1.py +2 -0
- pythonlings/curriculum/solutions/async10.py +2 -0
- pythonlings/curriculum/solutions/async2.py +2 -0
- pythonlings/curriculum/solutions/async3.py +2 -0
- pythonlings/curriculum/solutions/async4.py +2 -0
- pythonlings/curriculum/solutions/async5.py +2 -0
- pythonlings/curriculum/solutions/async6.py +2 -0
- pythonlings/curriculum/solutions/async7.py +2 -0
- pythonlings/curriculum/solutions/async8.py +2 -0
- pythonlings/curriculum/solutions/async9.py +2 -0
- pythonlings/curriculum/solutions/classes1.py +2 -0
- pythonlings/curriculum/solutions/classes10.py +2 -0
- pythonlings/curriculum/solutions/classes11.py +2 -0
- pythonlings/curriculum/solutions/classes12.py +2 -0
- pythonlings/curriculum/solutions/classes2.py +2 -0
- pythonlings/curriculum/solutions/classes3.py +2 -0
- pythonlings/curriculum/solutions/classes4.py +2 -0
- pythonlings/curriculum/solutions/classes5.py +2 -0
- pythonlings/curriculum/solutions/classes6.py +2 -0
- pythonlings/curriculum/solutions/classes7.py +2 -0
- pythonlings/curriculum/solutions/classes8.py +2 -0
- pythonlings/curriculum/solutions/classes9.py +2 -0
- pythonlings/curriculum/solutions/collections1.py +2 -0
- pythonlings/curriculum/solutions/collections10.py +2 -0
- pythonlings/curriculum/solutions/collections2.py +2 -0
- pythonlings/curriculum/solutions/collections3.py +2 -0
- pythonlings/curriculum/solutions/collections4.py +2 -0
- pythonlings/curriculum/solutions/collections5.py +2 -0
- pythonlings/curriculum/solutions/collections6.py +2 -0
- pythonlings/curriculum/solutions/collections7.py +2 -0
- pythonlings/curriculum/solutions/collections8.py +2 -0
- pythonlings/curriculum/solutions/collections9.py +2 -0
- pythonlings/curriculum/solutions/comprehensions1.py +2 -0
- pythonlings/curriculum/solutions/comprehensions10.py +2 -0
- pythonlings/curriculum/solutions/comprehensions2.py +2 -0
- pythonlings/curriculum/solutions/comprehensions3.py +2 -0
- pythonlings/curriculum/solutions/comprehensions4.py +2 -0
- pythonlings/curriculum/solutions/comprehensions5.py +2 -0
- pythonlings/curriculum/solutions/comprehensions6.py +2 -0
- pythonlings/curriculum/solutions/comprehensions7.py +2 -0
- pythonlings/curriculum/solutions/comprehensions8.py +2 -0
- pythonlings/curriculum/solutions/comprehensions9.py +2 -0
- pythonlings/curriculum/solutions/conditionals1.py +2 -0
- pythonlings/curriculum/solutions/conditionals10.py +2 -0
- pythonlings/curriculum/solutions/conditionals2.py +2 -0
- pythonlings/curriculum/solutions/conditionals3.py +2 -0
- pythonlings/curriculum/solutions/conditionals4.py +2 -0
- pythonlings/curriculum/solutions/conditionals5.py +2 -0
- pythonlings/curriculum/solutions/conditionals6.py +2 -0
- pythonlings/curriculum/solutions/conditionals7.py +2 -0
- pythonlings/curriculum/solutions/conditionals8.py +2 -0
- pythonlings/curriculum/solutions/conditionals9.py +2 -0
- pythonlings/curriculum/solutions/context_managers1.py +2 -0
- pythonlings/curriculum/solutions/context_managers2.py +2 -0
- pythonlings/curriculum/solutions/context_managers3.py +2 -0
- pythonlings/curriculum/solutions/context_managers4.py +2 -0
- pythonlings/curriculum/solutions/context_managers5.py +2 -0
- pythonlings/curriculum/solutions/context_managers6.py +2 -0
- pythonlings/curriculum/solutions/context_managers7.py +2 -0
- pythonlings/curriculum/solutions/context_managers8.py +2 -0
- pythonlings/curriculum/solutions/dataclasses1.py +2 -0
- pythonlings/curriculum/solutions/dataclasses2.py +2 -0
- pythonlings/curriculum/solutions/dataclasses3.py +2 -0
- pythonlings/curriculum/solutions/dataclasses4.py +2 -0
- pythonlings/curriculum/solutions/dataclasses5.py +2 -0
- pythonlings/curriculum/solutions/dataclasses6.py +2 -0
- pythonlings/curriculum/solutions/dataclasses7.py +2 -0
- pythonlings/curriculum/solutions/dataclasses8.py +2 -0
- pythonlings/curriculum/solutions/datetime1.py +2 -0
- pythonlings/curriculum/solutions/datetime2.py +2 -0
- pythonlings/curriculum/solutions/datetime3.py +2 -0
- pythonlings/curriculum/solutions/datetime4.py +2 -0
- pythonlings/curriculum/solutions/datetime5.py +2 -0
- pythonlings/curriculum/solutions/datetime6.py +2 -0
- pythonlings/curriculum/solutions/datetime7.py +2 -0
- pythonlings/curriculum/solutions/datetime8.py +2 -0
- pythonlings/curriculum/solutions/decorators1.py +2 -0
- pythonlings/curriculum/solutions/decorators10.py +2 -0
- pythonlings/curriculum/solutions/decorators2.py +2 -0
- pythonlings/curriculum/solutions/decorators3.py +2 -0
- pythonlings/curriculum/solutions/decorators4.py +2 -0
- pythonlings/curriculum/solutions/decorators5.py +2 -0
- pythonlings/curriculum/solutions/decorators6.py +2 -0
- pythonlings/curriculum/solutions/decorators7.py +2 -0
- pythonlings/curriculum/solutions/decorators8.py +2 -0
- pythonlings/curriculum/solutions/decorators9.py +2 -0
- pythonlings/curriculum/solutions/dictionaries1.py +2 -0
- pythonlings/curriculum/solutions/dictionaries10.py +2 -0
- pythonlings/curriculum/solutions/dictionaries2.py +2 -0
- pythonlings/curriculum/solutions/dictionaries3.py +2 -0
- pythonlings/curriculum/solutions/dictionaries4.py +2 -0
- pythonlings/curriculum/solutions/dictionaries5.py +2 -0
- pythonlings/curriculum/solutions/dictionaries6.py +2 -0
- pythonlings/curriculum/solutions/dictionaries7.py +2 -0
- pythonlings/curriculum/solutions/dictionaries8.py +2 -0
- pythonlings/curriculum/solutions/dictionaries9.py +2 -0
- pythonlings/curriculum/solutions/enums1.py +2 -0
- pythonlings/curriculum/solutions/enums2.py +2 -0
- pythonlings/curriculum/solutions/enums3.py +2 -0
- pythonlings/curriculum/solutions/enums4.py +2 -0
- pythonlings/curriculum/solutions/enums5.py +2 -0
- pythonlings/curriculum/solutions/enums6.py +2 -0
- pythonlings/curriculum/solutions/exceptions1.py +2 -0
- pythonlings/curriculum/solutions/exceptions10.py +2 -0
- pythonlings/curriculum/solutions/exceptions2.py +2 -0
- pythonlings/curriculum/solutions/exceptions3.py +2 -0
- pythonlings/curriculum/solutions/exceptions4.py +2 -0
- pythonlings/curriculum/solutions/exceptions5.py +2 -0
- pythonlings/curriculum/solutions/exceptions6.py +2 -0
- pythonlings/curriculum/solutions/exceptions7.py +2 -0
- pythonlings/curriculum/solutions/exceptions8.py +2 -0
- pythonlings/curriculum/solutions/exceptions9.py +2 -0
- pythonlings/curriculum/solutions/file_io1.py +2 -0
- pythonlings/curriculum/solutions/file_io10.py +2 -0
- pythonlings/curriculum/solutions/file_io2.py +2 -0
- pythonlings/curriculum/solutions/file_io3.py +2 -0
- pythonlings/curriculum/solutions/file_io4.py +2 -0
- pythonlings/curriculum/solutions/file_io5.py +2 -0
- pythonlings/curriculum/solutions/file_io6.py +2 -0
- pythonlings/curriculum/solutions/file_io7.py +2 -0
- pythonlings/curriculum/solutions/file_io8.py +2 -0
- pythonlings/curriculum/solutions/file_io9.py +2 -0
- pythonlings/curriculum/solutions/functional1.py +2 -0
- pythonlings/curriculum/solutions/functional10.py +2 -0
- pythonlings/curriculum/solutions/functional2.py +2 -0
- pythonlings/curriculum/solutions/functional3.py +2 -0
- pythonlings/curriculum/solutions/functional4.py +2 -0
- pythonlings/curriculum/solutions/functional5.py +2 -0
- pythonlings/curriculum/solutions/functional6.py +2 -0
- pythonlings/curriculum/solutions/functional7.py +2 -0
- pythonlings/curriculum/solutions/functional8.py +2 -0
- pythonlings/curriculum/solutions/functional9.py +2 -0
- pythonlings/curriculum/solutions/functions1.py +2 -0
- pythonlings/curriculum/solutions/functions10.py +2 -0
- pythonlings/curriculum/solutions/functions2.py +2 -0
- pythonlings/curriculum/solutions/functions3.py +2 -0
- pythonlings/curriculum/solutions/functions4.py +2 -0
- pythonlings/curriculum/solutions/functions5.py +2 -0
- pythonlings/curriculum/solutions/functions6.py +2 -0
- pythonlings/curriculum/solutions/functions7.py +2 -0
- pythonlings/curriculum/solutions/functions8.py +2 -0
- pythonlings/curriculum/solutions/functions9.py +2 -0
- pythonlings/curriculum/solutions/generators1.py +2 -0
- pythonlings/curriculum/solutions/generators10.py +2 -0
- pythonlings/curriculum/solutions/generators2.py +2 -0
- pythonlings/curriculum/solutions/generators3.py +2 -0
- pythonlings/curriculum/solutions/generators4.py +2 -0
- pythonlings/curriculum/solutions/generators5.py +2 -0
- pythonlings/curriculum/solutions/generators6.py +2 -0
- pythonlings/curriculum/solutions/generators7.py +2 -0
- pythonlings/curriculum/solutions/generators8.py +2 -0
- pythonlings/curriculum/solutions/generators9.py +2 -0
- pythonlings/curriculum/solutions/itertools1.py +2 -0
- pythonlings/curriculum/solutions/itertools2.py +2 -0
- pythonlings/curriculum/solutions/itertools3.py +2 -0
- pythonlings/curriculum/solutions/itertools4.py +2 -0
- pythonlings/curriculum/solutions/itertools5.py +2 -0
- pythonlings/curriculum/solutions/itertools6.py +2 -0
- pythonlings/curriculum/solutions/itertools7.py +2 -0
- pythonlings/curriculum/solutions/itertools8.py +2 -0
- pythonlings/curriculum/solutions/json1.py +2 -0
- pythonlings/curriculum/solutions/json2.py +2 -0
- pythonlings/curriculum/solutions/json3.py +2 -0
- pythonlings/curriculum/solutions/json4.py +2 -0
- pythonlings/curriculum/solutions/json5.py +2 -0
- pythonlings/curriculum/solutions/json6.py +2 -0
- pythonlings/curriculum/solutions/json7.py +2 -0
- pythonlings/curriculum/solutions/json8.py +2 -0
- pythonlings/curriculum/solutions/lists1.py +2 -0
- pythonlings/curriculum/solutions/lists10.py +2 -0
- pythonlings/curriculum/solutions/lists2.py +2 -0
- pythonlings/curriculum/solutions/lists3.py +2 -0
- pythonlings/curriculum/solutions/lists4.py +2 -0
- pythonlings/curriculum/solutions/lists5.py +2 -0
- pythonlings/curriculum/solutions/lists6.py +2 -0
- pythonlings/curriculum/solutions/lists7.py +2 -0
- pythonlings/curriculum/solutions/lists8.py +2 -0
- pythonlings/curriculum/solutions/lists9.py +2 -0
- pythonlings/curriculum/solutions/loops1.py +2 -0
- pythonlings/curriculum/solutions/loops10.py +2 -0
- pythonlings/curriculum/solutions/loops2.py +2 -0
- pythonlings/curriculum/solutions/loops3.py +2 -0
- pythonlings/curriculum/solutions/loops4.py +2 -0
- pythonlings/curriculum/solutions/loops5.py +2 -0
- pythonlings/curriculum/solutions/loops6.py +2 -0
- pythonlings/curriculum/solutions/loops7.py +2 -0
- pythonlings/curriculum/solutions/loops8.py +2 -0
- pythonlings/curriculum/solutions/loops9.py +2 -0
- pythonlings/curriculum/solutions/modules1.py +2 -0
- pythonlings/curriculum/solutions/modules2.py +2 -0
- pythonlings/curriculum/solutions/modules3.py +2 -0
- pythonlings/curriculum/solutions/modules4.py +2 -0
- pythonlings/curriculum/solutions/modules5.py +2 -0
- pythonlings/curriculum/solutions/modules6.py +2 -0
- pythonlings/curriculum/solutions/modules7.py +2 -0
- pythonlings/curriculum/solutions/modules8.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced1.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced10.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced11.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced12.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced2.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced3.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced4.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced5.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced6.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced7.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced8.py +2 -0
- pythonlings/curriculum/solutions/oop_advanced9.py +2 -0
- pythonlings/curriculum/solutions/pathlib1.py +2 -0
- pythonlings/curriculum/solutions/pathlib2.py +2 -0
- pythonlings/curriculum/solutions/pathlib3.py +2 -0
- pythonlings/curriculum/solutions/pathlib4.py +2 -0
- pythonlings/curriculum/solutions/pathlib5.py +2 -0
- pythonlings/curriculum/solutions/pathlib6.py +2 -0
- pythonlings/curriculum/solutions/recursion1.py +2 -0
- pythonlings/curriculum/solutions/recursion2.py +2 -0
- pythonlings/curriculum/solutions/recursion3.py +2 -0
- pythonlings/curriculum/solutions/recursion4.py +2 -0
- pythonlings/curriculum/solutions/recursion5.py +2 -0
- pythonlings/curriculum/solutions/recursion6.py +2 -0
- pythonlings/curriculum/solutions/recursion7.py +2 -0
- pythonlings/curriculum/solutions/recursion8.py +2 -0
- pythonlings/curriculum/solutions/regex1.py +2 -0
- pythonlings/curriculum/solutions/regex10.py +2 -0
- pythonlings/curriculum/solutions/regex2.py +2 -0
- pythonlings/curriculum/solutions/regex3.py +2 -0
- pythonlings/curriculum/solutions/regex4.py +2 -0
- pythonlings/curriculum/solutions/regex5.py +2 -0
- pythonlings/curriculum/solutions/regex6.py +2 -0
- pythonlings/curriculum/solutions/regex7.py +2 -0
- pythonlings/curriculum/solutions/regex8.py +2 -0
- pythonlings/curriculum/solutions/regex9.py +2 -0
- pythonlings/curriculum/solutions/sets1.py +2 -0
- pythonlings/curriculum/solutions/sets10.py +2 -0
- pythonlings/curriculum/solutions/sets2.py +2 -0
- pythonlings/curriculum/solutions/sets3.py +2 -0
- pythonlings/curriculum/solutions/sets4.py +2 -0
- pythonlings/curriculum/solutions/sets5.py +2 -0
- pythonlings/curriculum/solutions/sets6.py +2 -0
- pythonlings/curriculum/solutions/sets7.py +2 -0
- pythonlings/curriculum/solutions/sets8.py +2 -0
- pythonlings/curriculum/solutions/sets9.py +2 -0
- pythonlings/curriculum/solutions/strings1.py +2 -0
- pythonlings/curriculum/solutions/strings10.py +2 -0
- pythonlings/curriculum/solutions/strings2.py +2 -0
- pythonlings/curriculum/solutions/strings3.py +2 -0
- pythonlings/curriculum/solutions/strings4.py +2 -0
- pythonlings/curriculum/solutions/strings5.py +2 -0
- pythonlings/curriculum/solutions/strings6.py +2 -0
- pythonlings/curriculum/solutions/strings7.py +2 -0
- pythonlings/curriculum/solutions/strings8.py +2 -0
- pythonlings/curriculum/solutions/strings9.py +2 -0
- pythonlings/curriculum/solutions/testing1.py +2 -0
- pythonlings/curriculum/solutions/testing10.py +2 -0
- pythonlings/curriculum/solutions/testing11.py +2 -0
- pythonlings/curriculum/solutions/testing12.py +2 -0
- pythonlings/curriculum/solutions/testing2.py +2 -0
- pythonlings/curriculum/solutions/testing3.py +2 -0
- pythonlings/curriculum/solutions/testing4.py +2 -0
- pythonlings/curriculum/solutions/testing5.py +2 -0
- pythonlings/curriculum/solutions/testing6.py +2 -0
- pythonlings/curriculum/solutions/testing7.py +2 -0
- pythonlings/curriculum/solutions/testing8.py +2 -0
- pythonlings/curriculum/solutions/testing9.py +2 -0
- pythonlings/curriculum/solutions/tuples1.py +2 -0
- pythonlings/curriculum/solutions/tuples10.py +2 -0
- pythonlings/curriculum/solutions/tuples2.py +2 -0
- pythonlings/curriculum/solutions/tuples3.py +2 -0
- pythonlings/curriculum/solutions/tuples4.py +2 -0
- pythonlings/curriculum/solutions/tuples5.py +2 -0
- pythonlings/curriculum/solutions/tuples6.py +2 -0
- pythonlings/curriculum/solutions/tuples7.py +2 -0
- pythonlings/curriculum/solutions/tuples8.py +2 -0
- pythonlings/curriculum/solutions/tuples9.py +2 -0
- pythonlings/curriculum/solutions/type_hints1.py +2 -0
- pythonlings/curriculum/solutions/type_hints2.py +2 -0
- pythonlings/curriculum/solutions/type_hints3.py +2 -0
- pythonlings/curriculum/solutions/type_hints4.py +2 -0
- pythonlings/curriculum/solutions/type_hints5.py +2 -0
- pythonlings/curriculum/solutions/type_hints6.py +2 -0
- pythonlings/curriculum/solutions/type_hints7.py +2 -0
- pythonlings/curriculum/solutions/type_hints8.py +2 -0
- pythonlings/curriculum/solutions/variables1.py +2 -0
- pythonlings/curriculum/solutions/variables10.py +2 -0
- pythonlings/curriculum/solutions/variables2.py +2 -0
- pythonlings/curriculum/solutions/variables3.py +2 -0
- pythonlings/curriculum/solutions/variables4.py +2 -0
- pythonlings/curriculum/solutions/variables5.py +2 -0
- pythonlings/curriculum/solutions/variables6.py +2 -0
- pythonlings/curriculum/solutions/variables7.py +2 -0
- pythonlings/curriculum/solutions/variables8.py +2 -0
- pythonlings/curriculum/solutions/variables9.py +2 -0
- pythonlings/docs/NOTICE.md +9 -0
- pythonlings/docs/__init__.py +1 -0
- pythonlings/docs/index.json +160 -0
- pythonlings/docs/topics/__init__.py +1 -0
- pythonlings/docs/topics/async.md +97 -0
- pythonlings/docs/topics/classes.md +97 -0
- pythonlings/docs/topics/collections.md +96 -0
- pythonlings/docs/topics/comprehensions.md +97 -0
- pythonlings/docs/topics/conditionals.md +88 -0
- pythonlings/docs/topics/context_managers.md +97 -0
- pythonlings/docs/topics/dataclasses.md +97 -0
- pythonlings/docs/topics/datetime.md +97 -0
- pythonlings/docs/topics/decorators.md +91 -0
- pythonlings/docs/topics/dictionaries.md +96 -0
- pythonlings/docs/topics/enums.md +96 -0
- pythonlings/docs/topics/exceptions.md +96 -0
- pythonlings/docs/topics/file_io.md +96 -0
- pythonlings/docs/topics/functional.md +96 -0
- pythonlings/docs/topics/functions.md +97 -0
- pythonlings/docs/topics/generators.md +97 -0
- pythonlings/docs/topics/itertools.md +96 -0
- pythonlings/docs/topics/json.md +97 -0
- pythonlings/docs/topics/lists.md +97 -0
- pythonlings/docs/topics/loops.md +95 -0
- pythonlings/docs/topics/modules.md +97 -0
- pythonlings/docs/topics/oop_advanced.md +71 -0
- pythonlings/docs/topics/pathlib.md +79 -0
- pythonlings/docs/topics/recursion.md +73 -0
- pythonlings/docs/topics/regex.md +96 -0
- pythonlings/docs/topics/sets.md +97 -0
- pythonlings/docs/topics/strings.md +96 -0
- pythonlings/docs/topics/testing.md +97 -0
- pythonlings/docs/topics/tuples.md +97 -0
- pythonlings/docs/topics/type_hints.md +97 -0
- pythonlings/docs/topics/variables.md +97 -0
- pythonlings/pythonlings.tcss +123 -0
- pythonlings/screens/__init__.py +0 -0
- pythonlings/screens/docs.py +93 -0
- pythonlings/screens/topic_picker.py +107 -0
- pythonlings/screens/track.py +234 -0
- pythonlings/widgets/__init__.py +0 -0
- pythonlings/widgets/editor_pane.py +33 -0
- pythonlings/widgets/exercise_tree.py +33 -0
- pythonlings/widgets/output_panel.py +180 -0
- pythonlings/widgets/progress.py +15 -0
- pythonlings-0.3.0.dist-info/METADATA +259 -0
- pythonlings-0.3.0.dist-info/RECORD +942 -0
- pythonlings-0.3.0.dist-info/WHEEL +4 -0
- pythonlings-0.3.0.dist-info/entry_points.txt +2 -0
- pythonlings-0.3.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Exceptions
|
|
2
|
+
|
|
3
|
+
Source: https://docs.python.org/3/tutorial/errors.html#handling-exceptions
|
|
4
|
+
|
|
5
|
+
This local reference is generated from the official Python documentation and trimmed for pythonlings.
|
|
6
|
+
|
|
7
|
+
`try` and `except` handle errors without crashing the whole program.
|
|
8
|
+
|
|
9
|
+
## Extracted reference
|
|
10
|
+
|
|
11
|
+
8.3. Handling Exceptions
|
|
12
|
+
|
|
13
|
+
It is possible to write programs that handle selected exceptions. Look at the
|
|
14
|
+
following example, which asks the user for input until a valid integer has been
|
|
15
|
+
entered, but allows the user to interrupt the program (using Control-C or
|
|
16
|
+
whatever the operating system supports); note that a user-generated interruption
|
|
17
|
+
is signalled by raising the `KeyboardInterrupt` exception.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
>>> while True:
|
|
21
|
+
... try:
|
|
22
|
+
... x = int(input("Please enter a number: "))
|
|
23
|
+
... break
|
|
24
|
+
... except ValueError:
|
|
25
|
+
... print("Oops! That was no valid number. Try again...")
|
|
26
|
+
...
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The `try` statement works as follows.
|
|
31
|
+
|
|
32
|
+
-
|
|
33
|
+
|
|
34
|
+
First, the try clause (the statement(s) between the `try` and
|
|
35
|
+
`except` keywords) is executed.
|
|
36
|
+
|
|
37
|
+
-
|
|
38
|
+
|
|
39
|
+
If no exception occurs, the except clause is skipped and execution of the
|
|
40
|
+
`try` statement is finished.
|
|
41
|
+
|
|
42
|
+
-
|
|
43
|
+
|
|
44
|
+
If an exception occurs during execution of the `try` clause, the rest of the
|
|
45
|
+
clause is skipped. Then, if its type matches the exception named after the
|
|
46
|
+
`except` keyword, the except clause is executed, and then execution
|
|
47
|
+
continues after the try/except block.
|
|
48
|
+
|
|
49
|
+
-
|
|
50
|
+
|
|
51
|
+
## More reference
|
|
52
|
+
|
|
53
|
+
Source: https://docs.python.org/3/library/exceptions.html#concrete-exceptions
|
|
54
|
+
|
|
55
|
+
Concrete built-in exceptions like ValueError, KeyError, and TypeError.
|
|
56
|
+
|
|
57
|
+
Concrete exceptions
|
|
58
|
+
|
|
59
|
+
The following exceptions are the exceptions that are usually raised.
|
|
60
|
+
|
|
61
|
+
exception AssertionError
|
|
62
|
+
|
|
63
|
+
Raised when an `assert` statement fails.
|
|
64
|
+
|
|
65
|
+
exception AttributeError
|
|
66
|
+
|
|
67
|
+
Raised when an attribute reference (see Attribute references) or
|
|
68
|
+
assignment fails. (When an object does not support attribute references or
|
|
69
|
+
attribute assignments at all, `TypeError` is raised.)
|
|
70
|
+
|
|
71
|
+
The optional name and obj keyword-only arguments
|
|
72
|
+
set the corresponding attributes:
|
|
73
|
+
|
|
74
|
+
name
|
|
75
|
+
|
|
76
|
+
The name of the attribute that was attempted to be accessed.
|
|
77
|
+
|
|
78
|
+
obj
|
|
79
|
+
|
|
80
|
+
The object that was accessed for the named attribute.
|
|
81
|
+
|
|
82
|
+
Changed in version 3.10: Added the `name` and `obj` attributes.
|
|
83
|
+
|
|
84
|
+
exception EOFError
|
|
85
|
+
|
|
86
|
+
Raised when the `input()` function hits an end-of-file condition (EOF)
|
|
87
|
+
without reading any data. (Note: the `io.TextIOBase.read()` and
|
|
88
|
+
`io.IOBase.readline()` methods return an empty string when they hit EOF.)
|
|
89
|
+
|
|
90
|
+
exception FloatingPointError
|
|
91
|
+
|
|
92
|
+
Not currently used.
|
|
93
|
+
|
|
94
|
+
exception GeneratorExit
|
|
95
|
+
|
|
96
|
+
Raised when a generator or coroutine is closed;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# File I/O
|
|
2
|
+
|
|
3
|
+
Source: https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
|
|
4
|
+
|
|
5
|
+
This local reference is generated from the official Python documentation and trimmed for pythonlings.
|
|
6
|
+
|
|
7
|
+
`open` and `with` are the usual tools for reading and writing files safely.
|
|
8
|
+
|
|
9
|
+
## Extracted reference
|
|
10
|
+
|
|
11
|
+
7.2. Reading and Writing Files
|
|
12
|
+
|
|
13
|
+
`open()` returns a file object, and is most commonly used with
|
|
14
|
+
two positional arguments and one keyword argument:
|
|
15
|
+
`open(filename, mode, encoding=None)`
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
>>> f = open('workfile', 'w', encoding="utf-8")
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The first argument is a string containing the filename. The second argument is
|
|
23
|
+
another string containing a few characters describing the way in which the file
|
|
24
|
+
will be used. mode can be `'r'` when the file will only be read, `'w'`
|
|
25
|
+
for only writing (an existing file with the same name will be erased), and
|
|
26
|
+
`'a'` opens the file for appending; any data written to the file is
|
|
27
|
+
automatically added to the end. `'r+'` opens the file for both reading and
|
|
28
|
+
writing. The mode argument is optional; `'r'` will be assumed if it’s
|
|
29
|
+
omitted.
|
|
30
|
+
|
|
31
|
+
Normally, files are opened in text mode, that means, you read and write
|
|
32
|
+
strings from and to the file, which are encoded in a specific encoding.
|
|
33
|
+
If encoding is not specified, the default is platform dependent
|
|
34
|
+
(see `open()`).
|
|
35
|
+
Because UTF-8 is the modern de-facto standard, `encoding="utf-8"` is
|
|
36
|
+
recommended unless you know that you need to use a different encoding.
|
|
37
|
+
Appending a `'b'` to the mode opens the file in binary mode.
|
|
38
|
+
Binary mode data is read and written as `bytes` objects.
|
|
39
|
+
You can not specify encoding when opening file in binary mode.
|
|
40
|
+
|
|
41
|
+
In text mode, the default when reading is to convert platform-specific line
|
|
42
|
+
endings (`\n` on Unix, `\r\n` on Windows) to just `\n`. When writing in
|
|
43
|
+
text mode, the default is to convert occurrences of `\n` back to
|
|
44
|
+
platform-specific line endings. This behind-the-scenes modification
|
|
45
|
+
to file data is fine for text files, but will corrupt binary data like that in
|
|
46
|
+
`JPEG` or `EXE` files. Be very careful to use binary mode when
|
|
47
|
+
reading and writing such files.
|
|
48
|
+
|
|
49
|
+
It is good practice to use the `with` keyword when dealing
|
|
50
|
+
with file objects. The advantage is that the file is properly closed
|
|
51
|
+
|
|
52
|
+
## More reference
|
|
53
|
+
|
|
54
|
+
Source: https://docs.python.org/3/library/io.html#high-level-module-interface
|
|
55
|
+
|
|
56
|
+
The high-level `open()` interface and its modes.
|
|
57
|
+
|
|
58
|
+
High-level Module Interface
|
|
59
|
+
|
|
60
|
+
io.DEFAULT_BUFFER_SIZE
|
|
61
|
+
|
|
62
|
+
An int containing the default buffer size used by the module’s buffered I/O
|
|
63
|
+
classes. `open()` uses the file’s blksize (as obtained by
|
|
64
|
+
`os.stat()`) if possible.
|
|
65
|
+
|
|
66
|
+
io.open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)
|
|
67
|
+
|
|
68
|
+
This is an alias for the builtin `open()` function.
|
|
69
|
+
|
|
70
|
+
This function raises an auditing event `open` with
|
|
71
|
+
arguments path, mode and flags. The mode and flags
|
|
72
|
+
arguments may have been modified or inferred from the original call.
|
|
73
|
+
|
|
74
|
+
io.open_code(path)
|
|
75
|
+
|
|
76
|
+
Opens the provided file with mode `'rb'`. This function should be used
|
|
77
|
+
when the intent is to treat the contents as executable code.
|
|
78
|
+
|
|
79
|
+
path should be a `str` and an absolute path.
|
|
80
|
+
|
|
81
|
+
The behavior of this function may be overridden by an earlier call to the
|
|
82
|
+
`PyFile_SetOpenCodeHook()`. However, assuming that path is a
|
|
83
|
+
`str` and an absolute path, `open_code(path)` should always behave
|
|
84
|
+
the same as `open(path, 'rb')`. Overriding the behavior is intended for
|
|
85
|
+
additional validation or preprocessing of the file.
|
|
86
|
+
|
|
87
|
+
Added in version 3.8.
|
|
88
|
+
|
|
89
|
+
io.text_encoding(encoding, stacklevel=2, /)
|
|
90
|
+
|
|
91
|
+
This is a helper function for callables that use `open()` or
|
|
92
|
+
`TextIOWrapper` and have an `encoding=None` parameter.
|
|
93
|
+
|
|
94
|
+
This function returns encoding if it is not `None`.
|
|
95
|
+
Otherwise, it returns `"locale"` or `"utf-8"` depending on
|
|
96
|
+
UTF-8 Mode.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Functional Tools
|
|
2
|
+
|
|
3
|
+
Source: https://docs.python.org/3/howto/functional.html
|
|
4
|
+
|
|
5
|
+
This local reference is generated from the official Python documentation and trimmed for pythonlings.
|
|
6
|
+
|
|
7
|
+
Functional style uses functions, iterators, and transformations as building blocks.
|
|
8
|
+
|
|
9
|
+
## Extracted reference
|
|
10
|
+
|
|
11
|
+
Functional Programming HOWTO — Python 3.14.6 documentation
|
|
12
|
+
|
|
13
|
+
Navigation
|
|
14
|
+
|
|
15
|
+
-
|
|
16
|
+
index
|
|
17
|
+
|
|
18
|
+
-
|
|
19
|
+
modules |
|
|
20
|
+
|
|
21
|
+
-
|
|
22
|
+
next |
|
|
23
|
+
|
|
24
|
+
-
|
|
25
|
+
previous |
|
|
26
|
+
|
|
27
|
+
-
|
|
28
|
+
|
|
29
|
+
- Python »
|
|
30
|
+
|
|
31
|
+
-
|
|
32
|
+
|
|
33
|
+
-
|
|
34
|
+
|
|
35
|
+
-
|
|
36
|
+
3.14.6 Documentation »
|
|
37
|
+
|
|
38
|
+
- Python HOWTOs »
|
|
39
|
+
|
|
40
|
+
- Functional Programming HOWTO
|
|
41
|
+
|
|
42
|
+
-
|
|
43
|
+
|
|
44
|
+
|
|
|
45
|
+
|
|
46
|
+
-
|
|
47
|
+
|
|
48
|
+
Theme
|
|
49
|
+
|
|
50
|
+
Auto
|
|
51
|
+
|
|
52
|
+
## More reference
|
|
53
|
+
|
|
54
|
+
Source: https://docs.python.org/3/library/itertools.html#itertool-functions
|
|
55
|
+
|
|
56
|
+
itertools building blocks with signatures and usage patterns.
|
|
57
|
+
|
|
58
|
+
Itertool Functions
|
|
59
|
+
|
|
60
|
+
The following functions all construct and return iterators. Some provide
|
|
61
|
+
streams of infinite length, so they should only be accessed by functions or
|
|
62
|
+
loops that truncate the stream.
|
|
63
|
+
|
|
64
|
+
itertools.accumulate(iterable[, function, *, initial=None])
|
|
65
|
+
|
|
66
|
+
Make an iterator that returns accumulated sums or accumulated
|
|
67
|
+
results from other binary functions.
|
|
68
|
+
|
|
69
|
+
The function defaults to addition. The function should accept
|
|
70
|
+
two arguments, an accumulated total and a value from the iterable.
|
|
71
|
+
|
|
72
|
+
If an initial value is provided, the accumulation will start with
|
|
73
|
+
that value and the output will have one more element than the input
|
|
74
|
+
iterable.
|
|
75
|
+
|
|
76
|
+
Roughly equivalent to:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
def accumulate(iterable, function=operator.add, *, initial=None):
|
|
80
|
+
'Return running totals'
|
|
81
|
+
# accumulate([1,2,3,4,5]) → 1 3 6 10 15
|
|
82
|
+
# accumulate([1,2,3,4,5], initial=100) → 100 101 103 106 110 115
|
|
83
|
+
# accumulate([1,2,3,4,5], operator.mul) → 1 2 6 24 120
|
|
84
|
+
|
|
85
|
+
iterator = iter(iterable)
|
|
86
|
+
total = initial
|
|
87
|
+
if initial is None:
|
|
88
|
+
try:
|
|
89
|
+
total = next(iterator)
|
|
90
|
+
except StopIteration:
|
|
91
|
+
return
|
|
92
|
+
|
|
93
|
+
yield total
|
|
94
|
+
for element in iterator:
|
|
95
|
+
total = function(total, element)
|
|
96
|
+
yield total
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Functions
|
|
2
|
+
|
|
3
|
+
Source: https://docs.python.org/3/tutorial/controlflow.html#defining-functions
|
|
4
|
+
|
|
5
|
+
This local reference is generated from the official Python documentation and trimmed for pythonlings.
|
|
6
|
+
|
|
7
|
+
`def` creates reusable behavior with parameters, return values, and optional defaults.
|
|
8
|
+
|
|
9
|
+
## Extracted reference
|
|
10
|
+
|
|
11
|
+
4.8. Defining Functions
|
|
12
|
+
|
|
13
|
+
We can create a function that writes the Fibonacci series to an arbitrary
|
|
14
|
+
boundary:
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
>>> def fib(n): # write Fibonacci series less than n
|
|
18
|
+
... """Print a Fibonacci series less than n."""
|
|
19
|
+
... a, b = 0, 1
|
|
20
|
+
... while a < n:
|
|
21
|
+
... print(a, end=' ')
|
|
22
|
+
... a, b = b, a+b
|
|
23
|
+
... print()
|
|
24
|
+
...
|
|
25
|
+
>>> # Now call the function we just defined:
|
|
26
|
+
>>> fib(2000)
|
|
27
|
+
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The keyword `def` introduces a function definition. It must be
|
|
32
|
+
followed by the function name and the parenthesized list of formal parameters.
|
|
33
|
+
The statements that form the body of the function start at the next line, and
|
|
34
|
+
must be indented.
|
|
35
|
+
|
|
36
|
+
The first statement of the function body can optionally be a string literal;
|
|
37
|
+
this string literal is the function’s documentation string, or docstring.
|
|
38
|
+
(More about docstrings can be found in the section Documentation Strings.)
|
|
39
|
+
There are tools which use docstrings to automatically produce online or printed
|
|
40
|
+
documentation, or to let the user interactively browse through code; it’s good
|
|
41
|
+
practice to include docstrings in code that you write, so make a habit of it.
|
|
42
|
+
|
|
43
|
+
The execution of a function introduces a new symbol table used for the local
|
|
44
|
+
variables of the function. More precisely, all variable assignments in a
|
|
45
|
+
function store the value in the local symbol table; whereas variable references
|
|
46
|
+
first look in the local symbol table, then in the local symbol tables of
|
|
47
|
+
enclosing functions, then in the global symbol table, and finally in the table
|
|
48
|
+
of built-in names. Thus, global variables and variables of enclosing functions
|
|
49
|
+
cannot be directly assigned a value within a function (unless, for global
|
|
50
|
+
variables, named in a `global` statement, or, for variables of enclosing
|
|
51
|
+
|
|
52
|
+
## More reference
|
|
53
|
+
|
|
54
|
+
Source: https://docs.python.org/3/reference/compound_stmts.html#function-definitions
|
|
55
|
+
|
|
56
|
+
Function definition syntax including parameters, annotations, and decorators.
|
|
57
|
+
|
|
58
|
+
8.7. Function definitions
|
|
59
|
+
|
|
60
|
+
A function definition defines a user-defined function object (see section
|
|
61
|
+
The standard type hierarchy):
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
|
|
65
|
+
funcdef: [decorators] "def" funcname [type_params] "(" [parameter_list] ")"
|
|
66
|
+
["->" expression] ":" suite
|
|
67
|
+
decorators: decorator+
|
|
68
|
+
decorator: "@" assignment_expression NEWLINE
|
|
69
|
+
parameter_list: defparameter ("," defparameter)* "," "/" ["," [parameter_list_no_posonly]]
|
|
70
|
+
| parameter_list_no_posonly
|
|
71
|
+
parameter_list_no_posonly: defparameter ("," defparameter)* ["," [parameter_list_starargs]]
|
|
72
|
+
| parameter_list_starargs
|
|
73
|
+
parameter_list_starargs: "*" [star_parameter] ("," defparameter)* ["," [parameter_star_kwargs]]
|
|
74
|
+
| "*" ("," defparameter)+ ["," [parameter_star_kwargs]]
|
|
75
|
+
| parameter_star_kwargs
|
|
76
|
+
parameter_star_kwargs: "**" parameter [","]
|
|
77
|
+
parameter: identifier [":" expression]
|
|
78
|
+
star_parameter: identifier [":" ["*"] expression]
|
|
79
|
+
defparameter: parameter ["=" expression]
|
|
80
|
+
funcname: identifier
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
A function definition is an executable statement. Its execution binds the
|
|
85
|
+
function name in the current local namespace to a function object (a wrapper
|
|
86
|
+
around the executable code for the function). This function object contains a
|
|
87
|
+
reference to the current global namespace as the global namespace to be used
|
|
88
|
+
when the function is called.
|
|
89
|
+
|
|
90
|
+
The function definition does not execute the function body; this gets executed
|
|
91
|
+
only when the function is called. [4]
|
|
92
|
+
|
|
93
|
+
A function definition may be wrapped by one or more decorator expressions.
|
|
94
|
+
Decorator expressions are evaluated when the function is defined, in the scope
|
|
95
|
+
that contains the function definition. The result must be a callable, which is
|
|
96
|
+
invoked with the function object as the only argument. The returned value is
|
|
97
|
+
bound to the function name instead of the function object. Multiple decorators
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Generators
|
|
2
|
+
|
|
3
|
+
Source: https://docs.python.org/3/tutorial/classes.html#generators
|
|
4
|
+
|
|
5
|
+
This local reference is generated from the official Python documentation and trimmed for pythonlings.
|
|
6
|
+
|
|
7
|
+
Generators produce values lazily with `yield` instead of returning a whole collection.
|
|
8
|
+
|
|
9
|
+
## Extracted reference
|
|
10
|
+
|
|
11
|
+
9.9. Generators
|
|
12
|
+
|
|
13
|
+
Generators are a simple and powerful tool for creating iterators. They
|
|
14
|
+
are written like regular functions but use the `yield` statement
|
|
15
|
+
whenever they want to return data. Each time `next()` is called on it, the
|
|
16
|
+
generator resumes where it left off (it remembers all the data values and which
|
|
17
|
+
statement was last executed). An example shows that generators can be trivially
|
|
18
|
+
easy to create:
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
def reverse(data):
|
|
22
|
+
for index in range(len(data)-1, -1, -1):
|
|
23
|
+
yield data[index]
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
>>> for char in reverse('golf'):
|
|
29
|
+
... print(char)
|
|
30
|
+
...
|
|
31
|
+
f
|
|
32
|
+
l
|
|
33
|
+
o
|
|
34
|
+
g
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Anything that can be done with generators can also be done with class-based
|
|
39
|
+
iterators as described in the previous section. What makes generators so
|
|
40
|
+
compact is that the `__iter__()` and `__next__()` methods
|
|
41
|
+
are created automatically.
|
|
42
|
+
|
|
43
|
+
Another key feature is that the local variables and execution state are
|
|
44
|
+
automatically saved between calls. This made the function easier to write and
|
|
45
|
+
much more clear than an approach using instance variables like `self.index`
|
|
46
|
+
and `self.data`.
|
|
47
|
+
|
|
48
|
+
In addition to automatic method creation and saving program state, when
|
|
49
|
+
generators terminate, they automatically raise `StopIteration`. In
|
|
50
|
+
combination, these features make it easy to create iterators with no more effort
|
|
51
|
+
|
|
52
|
+
## More reference
|
|
53
|
+
|
|
54
|
+
Source: https://docs.python.org/3/reference/expressions.html#generator-expressions
|
|
55
|
+
|
|
56
|
+
Generator expression syntax for compact lazy iterators.
|
|
57
|
+
|
|
58
|
+
6.2.9. Generator expressions
|
|
59
|
+
|
|
60
|
+
The syntax for generator expressions is the same as for
|
|
61
|
+
list comprehensions, except that they are enclosed in
|
|
62
|
+
parentheses instead of brackets.
|
|
63
|
+
For example:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
>>> iterator = (x ** 2 for x in range(10))
|
|
67
|
+
>>> iterator
|
|
68
|
+
<generator object <genexpr> at ...>
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
At runtime, a generator expression evaluates to a generator iterator
|
|
73
|
+
which yields the same values as the corresponding list comprehension:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
>>> list(iterator)
|
|
77
|
+
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Thus, the example above is roughly equivalent to defining and calling
|
|
82
|
+
the following generator function:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
def make_generator_of_squares(iterator):
|
|
86
|
+
for x in iterator:
|
|
87
|
+
yield x ** 2
|
|
88
|
+
|
|
89
|
+
make_generator_of_squares(iter(range(10)))
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The enclosing parentheses can be omitted in calls when the generator
|
|
94
|
+
expression is the only positional argument and there are no keyword
|
|
95
|
+
arguments.
|
|
96
|
+
See the Calls section for details.
|
|
97
|
+
For example:
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Itertools
|
|
2
|
+
|
|
3
|
+
Source: https://docs.python.org/3/library/itertools.html
|
|
4
|
+
|
|
5
|
+
This local reference is generated from the official Python documentation and trimmed for pythonlings.
|
|
6
|
+
|
|
7
|
+
`itertools` provides fast iterator building blocks for loops and data pipelines.
|
|
8
|
+
|
|
9
|
+
## Extracted reference
|
|
10
|
+
|
|
11
|
+
itertools — Functions creating iterators for efficient looping — Python 3.14.6 documentation
|
|
12
|
+
|
|
13
|
+
Navigation
|
|
14
|
+
|
|
15
|
+
-
|
|
16
|
+
index
|
|
17
|
+
|
|
18
|
+
-
|
|
19
|
+
modules |
|
|
20
|
+
|
|
21
|
+
-
|
|
22
|
+
next |
|
|
23
|
+
|
|
24
|
+
-
|
|
25
|
+
previous |
|
|
26
|
+
|
|
27
|
+
-
|
|
28
|
+
|
|
29
|
+
- Python »
|
|
30
|
+
|
|
31
|
+
-
|
|
32
|
+
|
|
33
|
+
-
|
|
34
|
+
|
|
35
|
+
-
|
|
36
|
+
3.14.6 Documentation »
|
|
37
|
+
|
|
38
|
+
- The Python Standard Library »
|
|
39
|
+
|
|
40
|
+
- Functional Programming Modules »
|
|
41
|
+
|
|
42
|
+
- `itertools` — Functions creating iterators for efficient looping
|
|
43
|
+
|
|
44
|
+
-
|
|
45
|
+
|
|
46
|
+
|
|
|
47
|
+
|
|
48
|
+
-
|
|
49
|
+
|
|
50
|
+
Theme
|
|
51
|
+
|
|
52
|
+
## More reference
|
|
53
|
+
|
|
54
|
+
Source: https://docs.python.org/3/howto/functional.html#the-itertools-module
|
|
55
|
+
|
|
56
|
+
The functional HOWTO's tour of itertools with examples.
|
|
57
|
+
|
|
58
|
+
The itertools module
|
|
59
|
+
|
|
60
|
+
The `itertools` module contains a number of commonly used iterators as well
|
|
61
|
+
as functions for combining several iterators. This section will introduce the
|
|
62
|
+
module’s contents by showing small examples.
|
|
63
|
+
|
|
64
|
+
The module’s functions fall into a few broad classes:
|
|
65
|
+
|
|
66
|
+
-
|
|
67
|
+
|
|
68
|
+
Functions that create a new iterator based on an existing iterator.
|
|
69
|
+
|
|
70
|
+
-
|
|
71
|
+
|
|
72
|
+
Functions for treating an iterator’s elements as function arguments.
|
|
73
|
+
|
|
74
|
+
-
|
|
75
|
+
|
|
76
|
+
Functions for selecting portions of an iterator’s output.
|
|
77
|
+
|
|
78
|
+
-
|
|
79
|
+
|
|
80
|
+
A function for grouping an iterator’s output.
|
|
81
|
+
|
|
82
|
+
Creating new iterators
|
|
83
|
+
|
|
84
|
+
`itertools.count(start, step)` returns an infinite
|
|
85
|
+
stream of evenly spaced values. You can optionally supply the starting number,
|
|
86
|
+
which defaults to 0, and the interval between numbers, which defaults to 1:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
itertools.count() =>
|
|
90
|
+
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...
|
|
91
|
+
itertools.count(10) =>
|
|
92
|
+
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...
|
|
93
|
+
itertools.count(10, 5) =>
|
|
94
|
+
10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ...
|
|
95
|
+
|
|
96
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# JSON
|
|
2
|
+
|
|
3
|
+
Source: https://docs.python.org/3/library/json.html
|
|
4
|
+
|
|
5
|
+
This local reference is generated from the official Python documentation and trimmed for pythonlings.
|
|
6
|
+
|
|
7
|
+
`json` converts between Python values and JSON text.
|
|
8
|
+
|
|
9
|
+
## Extracted reference
|
|
10
|
+
|
|
11
|
+
json — JSON encoder and decoder — Python 3.14.6 documentation
|
|
12
|
+
|
|
13
|
+
Navigation
|
|
14
|
+
|
|
15
|
+
-
|
|
16
|
+
index
|
|
17
|
+
|
|
18
|
+
-
|
|
19
|
+
modules |
|
|
20
|
+
|
|
21
|
+
-
|
|
22
|
+
next |
|
|
23
|
+
|
|
24
|
+
-
|
|
25
|
+
previous |
|
|
26
|
+
|
|
27
|
+
-
|
|
28
|
+
|
|
29
|
+
- Python »
|
|
30
|
+
|
|
31
|
+
-
|
|
32
|
+
|
|
33
|
+
-
|
|
34
|
+
|
|
35
|
+
-
|
|
36
|
+
3.14.6 Documentation »
|
|
37
|
+
|
|
38
|
+
- The Python Standard Library »
|
|
39
|
+
|
|
40
|
+
- Internet Data Handling »
|
|
41
|
+
|
|
42
|
+
- `json` — JSON encoder and decoder
|
|
43
|
+
|
|
44
|
+
-
|
|
45
|
+
|
|
46
|
+
|
|
|
47
|
+
|
|
48
|
+
-
|
|
49
|
+
|
|
50
|
+
Theme
|
|
51
|
+
|
|
52
|
+
## More reference
|
|
53
|
+
|
|
54
|
+
Source: https://docs.python.org/3/tutorial/inputoutput.html#saving-structured-data-with-json
|
|
55
|
+
|
|
56
|
+
Tutorial on saving and loading structured data as JSON.
|
|
57
|
+
|
|
58
|
+
7.2.2. Saving structured data with `json`
|
|
59
|
+
|
|
60
|
+
Strings can easily be written to and read from a file. Numbers take a bit more
|
|
61
|
+
effort, since the `read()` method only returns strings, which will have to
|
|
62
|
+
be passed to a function like `int()`, which takes a string like `'123'`
|
|
63
|
+
and returns its numeric value 123. When you want to save more complex data
|
|
64
|
+
types like nested lists and dictionaries, parsing and serializing by hand
|
|
65
|
+
becomes complicated.
|
|
66
|
+
|
|
67
|
+
Rather than having users constantly writing and debugging code to save
|
|
68
|
+
complicated data types to files, Python allows you to use the popular data
|
|
69
|
+
interchange format called JSON (JavaScript Object Notation). The standard module called `json` can take Python
|
|
70
|
+
data hierarchies, and convert them to string representations; this process is
|
|
71
|
+
called serializing. Reconstructing the data from the string representation
|
|
72
|
+
is called deserializing. Between serializing and deserializing, the
|
|
73
|
+
string representing the object may have been stored in a file or data, or
|
|
74
|
+
sent over a network connection to some distant machine.
|
|
75
|
+
|
|
76
|
+
Note
|
|
77
|
+
|
|
78
|
+
The JSON format is commonly used by modern applications to allow for data
|
|
79
|
+
exchange. Many programmers are already familiar with it, which makes
|
|
80
|
+
it a good choice for interoperability.
|
|
81
|
+
|
|
82
|
+
If you have an object `x`, you can view its JSON string representation with a
|
|
83
|
+
simple line of code:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
>>> import json
|
|
87
|
+
>>> x = [1, 'simple', 'list']
|
|
88
|
+
>>> json.dumps(x)
|
|
89
|
+
'[1, "simple", "list"]'
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Another variant of the `dumps()` function, called `dump()`,
|
|
94
|
+
simply serializes the object to a text file. So if `f` is a
|
|
95
|
+
text file object opened for writing, we can do this:
|
|
96
|
+
|
|
97
|
+
```python
|