Convert csv to switch commands Python
First, your exception wrappers are useless:


try:
    f = destpath
except IOError:
    print "Cannot open specified file: %s" % destpath


destpath is already a file object. If there were an opening problem, then argparse would have told you with an exception at this level.


  parseCSV function can be rewritten in one line by turning the csv reader object to a list by iterating on it when building the list object:


def parseCSV(path):
    '''
    Parses a CSV file and return the rows as a list
    '''
    return list(csv.reader(path))


(I suggest that you close the file outside the parseCSV method as it wasn't its responsibility to open the file in the first place)


  outputCSV function:


don't use the indices here, iterate on the elements:

for i in range(len(rows)):


becomes:

for row in rows:  # "rows[i]" becomes "row"


now all those append statements can be simplified/shortened by passing lists to extend.

Also note that if rows[i][1] is not None is always True: csv module returns str objects, never None.

    new_list = []
    if re.match(r'switch\d$', rows[i][0]):  # no need for ^: it's match not search
        new_list.extend([row[0],'','hostname '+row[0],'!'])
        # skipping the "always true" condition, you may need to adapt this
        new_list.extend(['interface '+row[1].lower(),' switchport mode '+row[2],' switchport '+row[2]+' allow vlan '+row[3],'!'])
        # skipping the "always true" condition, you may need to adapt this                
        new_list.extend(['interface '+row[4].lower,' switchport mode '+row[5].lower(),' switchport '+row[5].lower()+' vlan '+rows[i][6]])
        writer.writerow(['\n'.join(new_list)])


Last but not least, when using csv &amp; text mode in Windows you stumble on the


  infamous blank-line-every-two-line bug ¹ ² ³


So for python 2 (seems to be the case), you may want to change the argparse for output to:

parser.add_argument('destpath', help="Output CSV file", type=argparse.FileType('ab'))  # open as binary


and for python 3:

parser.add_argument('destpath', help="Output CSV file", type=argparse.FileType('at',newline="")) # don't issue extra CR chars, well, some magic like that :)