For the most part "I have lived in London for 7 years." is correct.
The only thing that I would suggest is that you consider writing the number "7" out as "seven" this is more of a stylistic suggestion and there isn't really a hard-and-fast rule to writing numbers (at least that I'm aware of). Most style guides (Chicago and Modern Language Association [MLA]) however do suggest that you spell out numbers between one and ten and anything above ten you use digits.
I hope this helps!