You could filter out all empty values via:
tmp = [['back', 'dos'],
       ['buffer_overflow', 'u2r'],
       ['ftp_write', 'r2l'],
       ['guess_passwd', 'r2l'],
       ['imap', 'r2l'],
       ['ipsweep', 'probe'],
       ['land', 'dos'],
       ['loadmodule', 'u2r'],
       ['multihop', 'r2l'],
       ['neptune', 'dos'],
       ['nmap', 'probe'],
       ['perl', 'u2r'],
       ['phf', 'r2l'],
       ['pod', 'dos'],
       ['portsweep', 'probe'],
       ['rootkit', 'u2r'],
       ['satan', 'probe'],
       ['smurf', 'dos'],
       ['spy', 'r2l'],
       ['teardrop', 'dos'],
       ['warezclient', 'r2l'],
       ['warezmaster', 'r2l'],
       []]
# filter out empty lists
tmp = [a for a in tmp if a != []]
attack_map = {k:v for (k, v) in tmp}