Articles by Deepak Prasad
Python for Loop
Learn Python for loop syntax with simple examples using lists, strings, range(), dictionaries, nested loops, break, continue, pass, and for else.
Python YAML to Dictionary
Learn how to read a YAML file into a Python dictionary using PyYAML safe_load(), access nested YAML values, load multiple YAML documents, handle errors, and convert dict back to YAML.
Python Concatenate Lists
Learn how to concatenate, combine, and merge lists in Python using the + operator, extend(), +=, unpacking, itertools.chain(), and list comprehension, with examples and common mistakes.
Python Copy String
Learn how to copy a string in Python, why assignment is usually enough for immutable strings, and when slicing, str(), copy.copy(), or deepcopy() are unnecessary.
Cobalt Python Library for Akoma Ntoso XML
Learn how to use the Cobalt Python library to work with Akoma Ntoso XML documents, metadata, FRBR URIs, Act documents, validation, and document parsing.
Python Concatenate Strings: +, f-strings, join, and +=
Learn how to concatenate strings in Python with +, f-strings, str.join, +=, spaces, mixing variables and numbers, performance in loops, mistakes, and a quick reference table.
Python Copy List: Assignment, copy.copy(), and deepcopy()
Learn how to copy or clone a Python list using assignment, shallow copy.copy(), list slicing, list.copy(), and copy.deepcopy(), with examples that show when nested objects are shared or independent.
Global Variables in Python: global, local, nonlocal, and modules
Learn Python global vs local variables, when to use the global and nonlocal keywords, reading and writing globals from functions, mutables, modules, common mistakes, and a quick reference table.
Fix Unknown Time Zone Error in Google Calendar API
Fix Google Calendar API unknown time zone errors by using IANA time zone names, RFC3339 date-time strings with offsets, and Python zoneinfo—avoid ambiguous abbreviations like IST or PST.
Python enumerate() Function
Learn Python enumerate() with simple for loop examples. Use enumerate() to get index and value while looping through lists, strings, tuples, dictionaries, and files.
Python Dictionary Explained
Learn Python dictionary with simple examples, including dictionary syntax, creating dictionaries, accessing values, adding and updating items, looping, checking keys, removing items, and common dictionary methods.
Python Enum
Learn Python Enum with simple examples, including enum class syntax, name and value, iteration, auto(), IntEnum, StrEnum, enum methods, multiple attributes, and common mistakes.
Python Break Statement: for, while, Nested Loops, and else
Learn the Python break statement to exit for and while loops early, how break behaves in nested loops, how it interacts with loop else, break vs continue, and common mistakes.
Python Extend Dictionary
Learn how to extend a dictionary in Python using update(), the |= operator, the | merge operator, and dictionary unpacking. Also learn why dict has no extend() method like list.
Python Logging
Learn Python logging with simple examples. Configure logging using basicConfig(), log to console and file, use log levels, create loggers, handlers, formatters, and avoid common mistakes.
Python datetime Module
Learn Python datetime module with examples for date, time, datetime, now(), strftime(), strptime(), ctime(), timestamps, timedelta, and time zones using zoneinfo.
Python dataclass
Learn Python dataclass with simple examples, including @dataclass, default values, field(default_factory), frozen dataclasses, ordering, __post_init__, asdict(), and common mistakes.
Python casefold() String Method
Learn Python string casefold() with syntax, examples, Unicode case-insensitive comparison, casefold vs lower, and common mistakes when comparing strings.
Python if else Statement: Syntax, elif, Flowchart, and Examples
Learn the Python if, if else, and if elif else statements: syntax, indentation, elif vs else-if, conditions, flow, nested branches, ternary expressions, loop/try else, and common mistakes.
Python Check if File Exists
Learn how to check if a file exists in Python using pathlib Path.exists(), Path.is_file(), os.path.exists(), and os.path.isfile(), with examples for directories, symlinks, and file errors.
Python Return Multiple Values
Learn how to return multiple values from a Python function using comma-separated return values, tuple unpacking, lists, dictionaries, NamedTuple, dataclass, and common mistakes.
Python Tutorial for Beginners (Hands-On)
Free, complete Python tutorial for beginners - variables, strings, lists, dicts, control flow, OOP, file I/O, error handling, regex, concurrency, and Flask, with a full index of every linked hands-on lesson for Python …
Python argparse Example
Learn Python argparse with practical examples for positional arguments, optional flags, default values, type conversion, choices, nargs, boolean flags, and subcommands.
Python Call Function from Another File
Learn how to call a function from another Python file using import, from import, package imports from a different directory, importlib, and fixes for ModuleNotFoundError.
Python Multithreading Examples: Thread, Lock, Queue, and ThreadPoolExecutor
Learn Python multithreading with practical examples using threading.Thread, start(), join(), daemon threads, Lock, Queue, ThreadPoolExecutor, and best practices for I/O-bound tasks.
Python Multiprocessing Example: Process, Pool, and Queue
Learn Python multiprocessing with practical examples using Process, Pool, pool.map(), Queue, join(), CPU-bound tasks, shared data, and common multiprocessing mistakes.
Golang exec Command: Run Shell Commands, Capture Output, and Handle Errors
Learn how to run external commands in Go using os/exec, capture stdout and stderr, pass arguments, use shell commands, set timeouts, and avoid command injection.
Loop Through Two Lists in Python
Learn how to loop through two or more lists in Python using zip(), enumerate(), range(), indexes, nested loops, and zip_longest() for lists with different lengths.
Python Loop N Times: Repeat Code Using range()
Learn how to loop N times in Python using for range(), repeat code 5 or 10 times, loop without an index, use while loops, and avoid common off-by-one mistakes.
Python List with Examples
Learn Python lists with simple examples to create a list, access items, change values, add and remove elements, loop through lists, sort, copy, and use common list methods.

