Can't get around "IndexError: list index out of range"
erikwickstrom at gmail.com
erikwickstrom at gmail.com
Tue Oct 3 18:10:03 EDT 2006
Hi all,
I'm sorry about the newbie question, but I've been searching all
afternoon and can't find the answer!
I'm trying to get this bit of code to work without triggering the
IndexError.
import shutil, os, sys
if sys.argv[1] != None:
ver = sys.argv[1]
else:
ver = '2.14'
Of course, whenever I run it, I get list index out of range.
I'm coming from the php world where I can do:
if $_GET['var'] != Null {
$ver = $_GET['var'];
} else {
$ver = '2.14';
}
Can anyone tell me how to make this work in python?
Thanks!
Erik
More information about the Python-list
mailing list