Simplifying working Caesar cipher
I would define a shift function that shifted the letters like so:

from string import whitespace, punctuation

def shift(c, shift_by = 2):
    if c in whitespace + punctuation: return c

    upper_ord, lower_ord, c_ord = ord('A'), ord('a'), ord(c)
    c_rel = (c_ord - lower_ord) if c_ord &gt;= lower_ord else (c_ord - upper_ord)
    offset = lower_ord if c_ord &gt;= lower_ord else upper_ord
    return chr(offset + (c_rel + shift_by) % 26)


Then, to translate a message:

msg = 'a quick brown fox jumped over the lazy dog'
encoded_msg = ''.join(shift(l) for l in msg)


Alternatively, combine Mark Tolonen's maketrans suggestion with g.d.d's deque suggestion to get:

import string
from collections import deque

alphabet = string.ascii_lowercase
alphabet_deque = deque(alphabet)
alphabet_deque.rotate(-2)
rotated_alphabet = ''.join(alphabet_deque)
tbl = string.maketrans(alphabet, rotated_alphabet)


Then, later in the code:

msg = 'a quick brown fox jumped over the lazy dog'
encoded_msg = string.translate(msg, tbl)


This second method only works for lowercase letters, but you can always create two separate translation tables -- one for uppercase letters and another for lowercase letters -- to account for case.

Offtopic note: sometimes I wish Python had Smalltalk-like cascaded message sends. Ah well, one can dream.