It's generally better to use format(), like this:

```python
div = '<div class="starfield" data-field={name}></div>'.format(**locals())
div = '<div class="starfield" data-field={name}></div>'.format(name=name)
div = '<div class="starfield" data-field=%s></div>' % name
```

I like the first one best in case you need to format a lot of variables, but the second one is fine in this case also. The third one is officially deprecated, but the Python developers have indicated it isn't likely it will removed at one point because it usage is too widespread.