I have a string like this one:
# pap
which basically translates to a \\t#\\n\\tpap and I want to replace it with:
\\t#\\n\\tpap
This might work for you (GNU sed):
sed '/^\t#$/{n;/^\tpap$/{p;s//\tpython/}}' file
If a line contains only \t# print it, then if the next line contains only \tpap print it too, then replace that line with \tpython and print that.
\t#
\tpap
\tpython