I have a file that has between 1 or 4 words per line, and I want to sort by the third word in the line. The below code does not work if there isn't a word in the s[2] slot. Is there anything I can do to still sort everything does? Thanks

```
with open('myfile.txt') as fin:
lines = [line.split() for line in fin]
lines.sort(key=lambda s: s[2])

```