IDLE file saving problem
I am learning Python and need to use use IDLE, but I am having a problem. When I open a new window in IDLE and write my code, all is well. The coloring works and is very helpful. However, when I save the file I am working on, all the color disappears. And what is more frustrating is that when I open the saved file, it opens in TextEdit, so I have to copy it back into a new IDLE window to work on the code. If someone could clear up this seemingly simple problem for me, I would really appreciate it. Much thanks, Sean -- http://mail.python.org/mailman/listinfo/python-list
Help Please
In the book I am using, they give the following function as an example: def copyFile(oldFile, newFile): f1 = open(oldFile, 'r') f2 = open(newFile, 'w') while True: text = f1.read(50) if text == "": break f2.write(text) f1.close() f2.close() return My question is why does this function successfully copy a 200 character file, oldFile, to newFile? The line of code that reads, text = f1.read(50), does not seem to be iterative in any way to me. How is this fuction succeding in adding each additional set up 50 characters to the previous set of 50 characters read from oldFile? How does it even succeed in copying a 25 character file? If oldFile contains 25 characters, how does the program ever break out of the 'while True:' loop? I just don't see it. Again, much thanks to anyone who can clear this up. -Sean -- http://mail.python.org/mailman/listinfo/python-list
Import Problem - Please help
I am trying to learn NLP with Python and am getting the following error when trying to do an import statement: >>> import nltk >>> import re >>> from nltk_lite.utilities import re_show Traceback (most recent call last): File "", line 1, in ImportError: No module named nltk_lite.utilities I have installed nltk already and have a problem where I need to remove vowels from text. I think I need this module to complete it. Any help would be much appreciated. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Import Problem - Please help
On Sep 7, 5:40 pm, "newb.py" wrote: > I am trying to learn NLP with Python and am getting the following > error when trying to do an import statement: > > >>> import nltk > >>> import re > >>> from nltk_lite.utilities import re_show > > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named nltk_lite.utilities > > I have installed nltk already and have a problem where I need to > remove vowels from text. I think I need this module to complete it. > > Any help would be much appreciated. > > Thanks. My version of Python is 2.6.2. It seems that might make a difference here, but I can't figure it out. Again, any help would be fantastic. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Import Problem - Please help
On Sep 7, 6:55 pm, Ned Deily wrote: > In article > <8119a298-4660-4680-b460-0924c9baa...@e4g2000prn.googlegroups.com>, > > "newb.py" wrote: > > On Sep 7, 5:40 pm, "newb.py" wrote: > > > I am trying to learn NLP with Python and am getting the following > > > error when trying to do an import statement: > > > > >>> import nltk > > > >>> import re > > > >>> from nltk_lite.utilities import re_show > > > > Traceback (most recent call last): > > > File "", line 1, in > > > ImportError: No module named nltk_lite.utilities > > Guessing from the current documentation, try replacing the third line > with: > > >>> from nltk.util import re_show > > -- > Ned Deily, > n...@acm.org Fantastic. Thanks so much! -- http://mail.python.org/mailman/listinfo/python-list