Need help converting text to csv format

r0g aioe.org at technicalbloke.com
Fri Nov 21 19:04:32 EST 2008


>>>>>> On Nov 21, 10:18 am, Chuck Connors <don... at gmail.com> wrote:
>>>>>>> Any help, pseudo code, or whatever push in the right direction would
>>>>>>> be most appreciated.  I am a novice Python programmer but I do have a
>>>>>>> good bit of PHP programming experience.

<snip>


John Machin wrote:
> If I had to write such a script in Python, I'd be using the re and csv
> modules in similar fashion to responses already posted. If I had to
> write it in PHP, it'd be my first PHP script, so let's go Googling:
> 
> google("php regex") first hit:
> http://www.regular-expressions.info/php.html
> [yuk, 3 different toolkits; 3rd is PCRE, let's try that]
> 
> google("php csv") 3rd hit points to:
> http://www.php.net/manual/en/function.fputcsv.php
> 
> Doesn't seem too difficult to me.

I'm sure it doesn't, it doesn't to me either, but only because we
already know what he needs! Do you think if the OP knew all about
regular expressions and understood that python has a handy csv module
that he'd be asking this question here?

The OP is used to PHP, a fairly different kettle of fish. Disgusting
though PHP is it is many peoples first programming language, often in
the unpleasant form of mod_php on a web server - clearly we are not
dealing with a linux kernel hacker here.

I don't think it's at all unreasonable to come here and ask for "help,
pseudo code, or whatever push in the right direction", and I certainly
don't see a need to start questioning his credentails.

He needs to know about the re and csv modules. A minimal yet polite
response might have been: Go and google for the re and csv modules. You
could have typed that, saved yourself a few hundred keystrokes and
helped someone in the process.

If you can't muster even that level of enthusiasm or courtesy towards
the noobs then you always have the option of not responding.

:-/

Roger.



More information about the Python-list mailing list