:help modeline). It worth to remember that text before and after main part has to be commenting out directive. Therefore, for example the line in HTML might looks similar to:
<-- vim: set tabstop=4 noexpandtab:-->for python:
# vim: tabstop=4 noexpandtab:If you like to learn more please check the modeline keyword in Vim help.
update: I forgot to add that you need to set modeline in .vimrc file.