Request for py program to insert space between two characters and saved as text?

r0g aioe.org at technicalbloke.com
Tue Dec 8 08:55:16 EST 2009


Dennis Lee Bieber wrote:
> On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old <withblessings at gmail.com>
> declaimed the following in gmane.comp.python.general:
> 
>> For Kannada project .txt(not .doc) is used, my requirement is to have one
<snip>
>> In this context, I request you kindly for small python program - to make or
> 
> 	Excuse me -- you want one of US to supply you with a program that
> will be used for YOUR entry to some job site? (At least, that's what I
> seem to be finding for "Kannada project")
> 


Well it is only a 2 line program and he did ask nicely after all, if you
begrudge him it then feel free to not answer, righteous indignation
rarely helps anyone.

Dear OP...

Put the following 2 lines into a file and save it as spacer.py

import sys
print ' '.join([e for e in open(sys.argv[1], 'r').read()])


Then open a terminal window and 'cd' to the same folder you just saved
the spacer.py file in. Type...

python spacer.py inputfile.txt > outputfile.txt

This will run inputfile.txt through the space adding program we have
just saved and then 'pipe' the output of that into a new file outputfile.txt

Hope this helps,


Roger Heathcote.



More information about the Python-list mailing list