Simple Text Editor in Python