sudo san
April 29th, 2013, 08:41 PM
Hi, I am using python 3.2.3 and also a beginner in python programming.
I would like to know how to go about changing words (or a string of words/numbers) in a file to something else.
I can do this in bash
For example:
sed -i 's/text_in_file/new_text/g' 'path_to_file'
I know that there is some way to do this but I don't want to use os.system as a substitute.
Any ideas?
Thanks in advance.
I would like to know how to go about changing words (or a string of words/numbers) in a file to something else.
I can do this in bash
For example:
sed -i 's/text_in_file/new_text/g' 'path_to_file'
I know that there is some way to do this but I don't want to use os.system as a substitute.
Any ideas?
Thanks in advance.