Q38: What are the differences between the 'sys' and 'os' modules?

  • sys: Interacts directly with the Python Interpreter (sys.argv, sys.path, sys.exit(), sys.getrefcount()).
  • os: Interacts with the underlying Operating System (os.path, os.environ, os.mkdir(), os.listdir()).
Key Takeaways
  • sys: Interpreter runtime context.
  • os: Operating system filesystem and environment interaction.
Knowledge Check

Which module provides the list of command-line arguments (sys.argv) passed to a Python script?