Lena Dunham has defended Taylor Swift for not endorsing a candidate in the US presidential election.

The 'Girls' creator was one of a number of stars who campaigned for Hillary Clinton when she ran against Donald Trump but her close friend Taylor was blasted for not aligning herself with a candidate.

Lena told Rolling Stone: ''I just think everyone has to do it their way. When I was lesser known, I was like, 'Who could not share their opinion?' Then I found out that when you talk about politics, people straight up tweet you the floor plan of your house and say they're coming to your house. You have to f**king watch it because people are nuts.''

Lena, 30, also praised Taylor, 27, for how she deals with criticism and for her approach to her career.

She said: ''She's been in the public eye since she was 15. I felt young when my career started and I was 23, 24. When I met her, she was newly 22, and she was a seasoned pro at this stuff.

''Watching the way that she understands the vicissitudes of the cycle, and she just keeps making her work, - that's just really impressive to me. That's how I hope to live my life, which is not as a slave to public opinion, but just as somebody who continues to make things. She's truly just an artist who has to make things to survive. I guess that's what we have most in common.

''And she's never not making music. If people know about it or they don't, she's never not making music, and that's like, something that I've really watched with a lot of admiration. Because she's been put through the ringer, and she's continued to make her work. People who understand how to protect themselves but aren't so beaten down that they can't be creative - that to me is the greatest.''