All 45 questions

  1. How do you implement a Python context manager, and which methods does the with statement call?

    Asked in 3 of 281 interviews · last asked Aug 19 · Concept · Junior

    Other ways it was asked
    • “Which special methods must an object implement to work with Python's `with` statement, and what are they called?”
    • “How do you define a context manager in Python?”
    • “In Python 3, explain what a context manager is.”
  2. What are errors and exceptions in Python, and how are exceptions handled?

    Asked in 3 of 281 interviews · last asked Sep 17 · Concept · Junior

    Other ways it was asked
    • “Can you explain what an error or exception is in Python?”
    • “How do errors and exceptions differ in Python, and what does each represent?”
    • “What distinguishes errors from exceptions in Python, and how are exceptions typically handled?”
  3. How do you raise an exception in Python?

    Asked in 2 of 281 interviews · last asked Jul 7 · Concept · Junior

    Other ways it was asked
    • “How would you raise an exception in Python?”
  4. How do you read from or write to files in Python?

    Asked in 2 of 281 interviews · last asked Oct 3 · Concept · Junior

    Other ways it was asked
    • “How do you read from and write to files in Python?”
  5. How do you import and use a Python library, such as `math` or `random`?

    Asked in 2 of 281 interviews · last asked Aug 18 · Concept · Junior

  6. What is a module in Python?

    Asked in 2 of 281 interviews · last asked Oct 18 · Concept · Junior

    Other ways it was asked
    • “What are modules and packages in Python?”
  7. How do you read five bytes from a file in Python?

    Asked once · last asked Feb 24 · Tooling · Junior

  8. Which functions in Python's `json` module serialize and deserialize data?

    Asked once · last asked Feb 24 · Concept · Junior

  9. What is the difference between json.load and json.dump?

    Asked once · last asked Apr 22 · Concept · Junior

  10. How would you use Python to parse system log lines, extract timestamps, log levels, and messages, and store the results in a structured format?

    Asked once · last asked May 18 · Scenario · Junior

  11. How do you structure a Python project and its packages to keep it maintainable as it grows?

    Asked once · last asked Aug 13 · Concept · Mid-level

  12. How do you prevent circular imports as packages and shared utilities grow?

    Asked once · last asked Aug 13 · Concept · Mid-level

  13. How do you enforce consistent logging and error-handling standards across a large Python codebase during code reviews?

    Asked once · last asked Aug 13 · Scenario · Senior

  14. Can you explain how Python's try/except/else/finally blocks work, and when you'd use else versus finally?

    Asked once · last asked Aug 16 · Concept · Junior

  15. Can you write Python code to move data from a text file into Excel columns when the text file contains key-value pairs separated by semicolons or colons?

    Asked once · last asked Aug 25 · Write code · Junior

  16. How do correlation IDs help troubleshoot Python services?

    Asked once · last asked Aug 30 · Concept · Mid-level

  17. How do you structure logging and debugging for a Python script, including which events to log and how to mask secrets?

    Asked once · last asked Sep 8 · Tooling · Mid-level

  18. How do you handle custom exceptions using try, except, else, and finally in Python?

    Asked once · last asked Sep 11 · Concept · Junior

  19. How would you characterize the underlying failure in an AI-generated Python response, and what written feedback would you give to help prevent the same mistake?

    Asked once · last asked Sep 15 · Scenario · Mid-level

  20. Which Python libraries, frameworks, or design choices would you use to handle errors and manage workflows, and why?

    Asked once · last asked Sep 21 · Concept · Mid-level

    Other ways it was asked
    • “Which Python library, framework, or design choice made the biggest difference in handling errors and workflows?”
  21. In Python or Bash, how would you robustly parse and validate a CLI command's JSON output, including non-zero exit codes and partial or malformed JSON in an automation script?

    Asked once · last asked Sep 28 · Write code · Mid-level

  22. Write a Python function that reads a JSON file containing healthcare patient records and extracts all patients whose age is above 60. The function should return a list of patient IDs. Provide an example input and output.

    Asked once · last asked Sep 29 · Write code · Mid-level

  23. What is the difference between `Exception` and `ValueError` in Python?

    Asked once · last asked Sep 29 · Concept · Junior

  24. What is wrong with placing `except Exception` before `except ValueError`, and how should the handlers be ordered?

    Asked once · last asked Sep 29 · Concept · Mid-level

  25. How would you read a JSON configuration file in Python?

    Asked once · last asked Sep 30 · Write code · Junior

  26. What are pickling and unpickling in Python, and when would you use them?

    Asked once · last asked Oct 10 · Concept · Mid-level

  27. In Python, how would you run an external command so that stdout and stderr are streamed live to the console while also being captured in full for later parsing and error handling?

    Asked once · last asked Oct 13 · Write code · Senior

  28. What does lazy import in Python 3.15 mean?

    Asked once · last asked Oct 22 · Concept · Mid-level

  29. How do you pass command-line arguments to a Python script?

    Asked once · last asked Aug 26 · Tooling · Junior

    Other ways it was asked
    • “How can a Python script access command-line arguments?”
  30. Can you tell me about exception handling in Python?

    Asked once · last asked Sep 2 · Concept · Junior

    Other ways it was asked
    • “How is exception handling performed in Python?”
  31. What is the use of .ini files in Python?

    Asked once · last asked Sep 18 · Concept · Junior

    Other ways it was asked
    • “How are .ini files used to configure Python automation?”
  32. How do you typically open and process a file in Python?

    Asked once · last asked Feb 24 · Tooling · Junior

  33. When opening a file in Python with the default mode, do you need to specify anything beyond the file path?

    Asked once · last asked Feb 24 · Tooling · Junior

  34. When opening a file with a Python `with` statement, do you need to assign the file object an alias using `as`?

    Asked once · last asked Feb 24 · Concept · Junior

  35. How do you import a specific function from a Python module, and how can you alias an imported module?

    Asked once · last asked Jun 27 · Concept · Junior

  36. How do you load a configuration file in Python?

    Asked once · last asked Jul 26 · Tooling · Junior

  37. How can you pretty-print data in Python to make its structure easier to inspect?

    Asked once · last asked Jul 31 · Tooling · Junior

  38. How do you import Python's `random` library and use `randint` in code?

    Asked once · last asked Aug 18 · Write code · Junior

  39. How does Python's `with open` context manager work when reading from or writing to a text file?

    Asked once · last asked Aug 25 · Concept · Junior

  40. Write a Python program to print the error logs from the available log file.

    Asked once · last asked Sep 10 · Write code · Junior

    Other ways it was asked
    • “Write a Python program to print only the error logs from the log file and count how many error logs there are.”
  41. How would you read and print the contents of a log file in Python?

    Asked once · last asked Sep 10 · Write code · Junior

  42. Why use a virtual environment such as venv in a Python project?

    Asked once · last asked Oct 7 · Concept · Junior

  43. What is the purpose of if __name__ == "__main__"?

    Asked once · last asked Oct 15 · Concept · Junior

  44. What are exceptions?

    Asked once · last asked Oct 18 · Concept · Junior

  45. How do you convert JSON into a Python dictionary?

    Asked once · last asked Oct 23 · Concept · Junior

More Python interview questions

How this list is made

Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.

Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.

The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every Python interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.

281 interviews, 199 candidates, Nov 2025 to Oct 2026. Updated every month with new interviews.