'Can any one please explain how these lines of sys.argv are working,

When I pass any variable to command line, it prints that parameter and when I did pass any parameter to command line while executing my python file, it gives me error. I am wondered, When the else statement will be executed.

if sys.argv[1]:
    ProcessPerameter = sys.argv[1]
else: 
    ProcessPerameter = 'Monthly'
print(ProcessPerameter) 

I know the my question isn't technical, But I shall be grateful, If anyone can help me out



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source