Re: editing text file
On Wed, 25 Jun 2003 18:05:53 +0200, ataraxia2500
> is there a function that can search for specific words in a text file (kind
>of like grep) and change them?
>say in my text file there's a line such as:
>and my function would search the line [myvalue] and replace X by Y.
>thanx in advance
Use a for line in file.readlines() loop and the re module for your
matching. Though, to be honest, if that's all you want to do then
Python is probably an overkill; there's probably a port of sed for
your platform, whatever platform it is, and I reckon that would be the
appropriate level of tool.
|All times are GMT. The time now is 11:08 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.