Help with mass remove in text file

2005-07-13 Thread rorley
I'm trying to open a text file, remove all instances of the words f=x; and i=x; where x can be any number 0-14. Also, I want to remove all {or ) or ( or ' } each time one of those characters occurs respectively. This is what I've been able to piece together... import os, string x = (f=;)

Help with inverted dictionary

2005-07-12 Thread rorley
I'm new to Python and I'm struggling. I have a text file (*.txt) with a couple thousand entries, each on their own line (similar to a phone book). How do I make a script to create something like an inverted dictionary that will allow me to call robert and create a new text file of all of the

Re: Help with inverted dictionary

2005-07-12 Thread rorley
OK, so my problem is I have a text file with all of these instances, for example 5000 facts about animals. I need to go through the file and put all of the facts (lines) that contain the word lion into a file called lion.txt. If I come across an animal or other word for which a file does not yet

Re: Help with inverted dictionary

2005-07-12 Thread rorley
I will transfer eventually use a database but is there any way for now you could help me make the text files? Thank you so much. Reece -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with inverted dictionary

2005-07-12 Thread rorley
I will transfer eventually use a database but is there any way for now you could help me make the text files? Thank you so much. Reece -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with inverted dictionary

2005-07-12 Thread rorley
Yes, I am. Does that make it harder. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with inverted dictionary

2005-07-12 Thread rorley
Not quite homework but a special project. Thanks for the advice. I'll let you know if I run into anymore stumbling blocks. Reece -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with inverted dictionary

2005-07-12 Thread rorley
Thanks for the hints, I think I've figured it out. I've only been using Python for 2 days so I really needed the direction. If you were curious, this is not homework but an attempt to use the ConceptNet data (its an MIT AI project) to make a website in a Wiki-like format that would allow the