1 Replies - 400 Views - Last Post: 05 December 2012 - 04:04 AM Rate Topic: -----

#1 DickThompson1974  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 1
  • Joined: 05-December 12

Open and search multiple text files

Posted 05 December 2012 - 02:42 AM

Hi,
I'm new to Python and I'm trying to make a program that can:
1 : Open multiple text files with raw input.
2 : Save each text file with it's content. (and assign every file with a unique number).

Later I want to search for one or more words in the files.

I hope you can help me getting started.

Thanks
Is This A Good Question/Topic? 1
  • +

Replies To: Open and search multiple text files

#2 alexr1090  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 44
  • View blog
  • Posts: 125
  • Joined: 08-May 11

Re: Open and search multiple text files

Posted 05 December 2012 - 04:04 AM

you can't open them with raw input. Are you talking about opening them with what you get from raw_input? If so, just make sure the directory is correct and type
r = open('filename','r')


Not sure what you mean by saving each text file with it's content. If the text file already exists why save it?

For searching through text files look into regular expression (re module).

hopefully that'll get you started...

This post has been edited by alexr1090: 05 December 2012 - 04:08 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1