Python / Pyth, 2424 22 bytes
Thanks to @Loovjo and @Pietu1998 for some help
#"treat".q
print"trick";
In Pyth, this outputsoutputs treat
. In Python, this outputsoutputs trick
.
How it works
Python
#"treat".q Comment
print"trick"; Print the string literal "trick"
Pyth
#"treat".q
# Loop until error statement
"treat" Implicitly print the string literal "treat"
print"trick"; Throws an error since n has no .qright operand, breaking out of the Quitloop
print"trick"; Ignored, except the The last ";" asis a valid EOF