Spell checking and Python
Dave Kuhlman
dkuhlman at rexx.com
Mon Dec 15 20:01:04 EST 2003
Gilles Lenfant wrote:
> Hi pythonists,
>
> Any experience or pointer on using a spell checker (aspell, ispell
> ?) with a Python app ?
>
> Many thanks by advance
Here is one way for UNIX/Linux running with X Windows:
def check(content):
file = open('ispell.tmp', 'w')
file.write(content)
file.close()
os.system('xterm -e ispell ispell.tmp')
file = open('ispell.tmp', 'r')
content = file.read()
file.close()
return content
You might want to use the tempfile module in the Python standard
library to create the temporary file, though.
Dave
--
http://www.rexx.com/~dkuhlman
dkuhlman at rexx.com
More information about the Python-list
mailing list