What’s wrong with my code? What is argv[1]?

I’m trying to ask the user to type in a string so I will print the length of the string. My code is built succeeded. However, when I entered a word and pressed ‘enter’, the program keeps running. I had to enter a second word, then the length of the first string displays. I’m confused … Read more

from sys import argv – what is the function of “script”

Generally, the first argument to a command-line executable is the script name, and the rest are the expected arguments. Here, argv is a list that is expected to contain two values: the script name and an argument. Using Python’s unpacking notation, you can write as while also throwing errors if there are an unexpected number of arguments … Read more

Is “argv[0] = name-of-executable” an accepted standard or just a common convention?

Guesswork (even educated guesswork) is fun but you really need to go to the standards documents to be sure. For example, ISO C11 states (my emphasis): If the value of argc is greater than zero, the string pointed to by argv[0] represents the program name; argv[0][0] shall be the null character if the program name is not available from the host environment. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)