How do you limit the input to 6 characters as well as catch if any special characters were inserted?
1 Answer
Do you mean raw_input() ? (http://docs.python.org/2/library/functions.html#raw_input)
EDITED TO ADD:
Try something like this:
if len(sys.argv) > 1:
ssid_end = sys.argv[1].lower()
else:
ssid_end = raw_input("==> ").lower()
4 Comments
Ofir Israel
So you're saying you're running
python wifi.py [something] and it raises this IndexError ?SpringField
I added "userinput = raw_input('--> ')" at the top below both "import" and once I run the program and insert the 6 characters it shows me this error. Otherwise it's fine and I can run the script without raw_input()
Ofir Israel
Ah of course if you run the script without any parameters you shouldn't try reading
sys.argv[1].SpringField
WOW ! Hats off dude, love you so much ! It works with your code, thank you, thank you so much !