Are you sure your clipboard has tab characters, not literal backslashes followed by ts? (For example, if you copy and paste the string from the first line of your source code, you'll get backslashes and ts, not tabs.)
–
abarnertMar 29 '13 at 22:37

The unicode_escape codec is described in the list of Standard Encodings in the codecs module. It's defined as:

Produce a string that is suitable as Unicode literal in Python source code

In other words, if you encode with this codec, it will replace each non-printing Unicode character with an escape sequence that you can type into your source code. If you've got a tab character, it'll replace that with a backslash character and a t.

You want to do the exact reverse of that: you've got a string you copied out of source code, with source-code-style escape sequences, and you want to interpret it the same way the Python interpreter does. So, you just decode with the same codec. If you've got a backslash followed by a t, it'll replace them with a tab character.

It's worth playing with this in the interactive interpreter (remember to keep the repr and str representations straight while doing so!) until you get it.