Former White House press secretary Sean Spicer (Photo by Jabin Botsford/The Washington Post)

Breaking up is hard to do, but Sean Spicer seems to have figured it out. Corey Lewandowski showed him the way.

Hours after resigning as White House press secretary on Friday, Spicer offered nothing but praise and gratitude for President Trump in an interview with Fox News’s Sean Hannity. His remarks were remarkably similar to those of Corey Lewandowski on the day 13 months ago when Trump fired Lewandowski as campaign manager.

Spicer: “It’s been an honor and a privilege to serve the president and this country.”

Lewandowski: “I had a nice conversation with Mr. Trump, and I said to him it’s been an honor and a privilege to be part of this.”

Spicer: “I have no regrets.”

Lewandowski: “I have no regrets.”

Spicer: “The president’s doing so many amazing things on behalf of this country.”

Lewandowski: Voters have “got to choose Trump if they want to save our country.”

Showing loyalty to Trump after a split has worked out pretty well for Lewandowski. He landed a gig as a CNN commentator for the remainder of the election, did a stint at a lobbying firm that he co-founded and — most notably — remained a player in Trump’s world. He has been considered for a formal role in the White House and just this week was on Capitol Hill with another former Trump aide, David Bossie, trying to convince Sen. Mike Lee (R-Utah) to back a GOP health-care plan.

If you can swallow your pride and not trash Trump on your way out the door, you can stay in his orbit and maybe even work your way back onto his team.

Spicer told Hannity that he got a critical guarantee from the president: “He assured me that he would continue to be as supportive as he always has been.”

If Spicer plays nice after his exit — if he follows Lewandowski’s guide to surviving a breakup — Trump will reward him.