import re print re.sub("0x([0-9A-F]+)", r"x'\1'::int", "0x0A 0xFD")
Standard input is empty
x'0A'::int x'FD'::int
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!