Using Main With Command-Line Arguments
Mon 10 August 2026
import sys
def main():
print("Arguments received:", sys.argv)
if __name__ == "__main__":
main()
Arguments received: ['C:\\Users\\Ashwin\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\ipykernel_launcher.py', '-f', 'C:\\Users\\Ashwin\\AppData\\Roaming\\jupyter\\runtime\\kernel-381afcb6-19e6-489b-be48-09b4fef13007.json']
Score: 10
Category: chapter14_main_function