r0g wrote:
Dennis Lee Bieber wrote:
On Tue, 8 Dec 2009 08:26:58 +0530, 74yrs old <withblessi...@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.

That seems a bit dangerous to give to a beginner at Python, without discussing Unicode issues. If he's in Python 3.x, and if the default encoder is ASCII, which it seems to be most places, then he'll quickly get a conversion error for some character. And if it's some other 8 bit form, he might not get an error, but find that a space is inserted between two of the bytes of a UTF-8 code.

DaveA

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to