Lutger:

> Here is a quick attempt:
> 
> import std.file, std.regex;
> 
> void main(string[] args)
> {
>     args[1].write( args[1].readText().replace( regex("#.*", "g"), "") );
> }

It's cute. Compared to the Python version it doesn't work lazily (by lines).

I have tried on Windows that D program and the Python program on a text file 
that has Unix newlines. The Python program has produced an output with Windows 
newlines, while the D program has produced an output with Unix newlines. I 
think Python is more correct here.

Bye,
bearophile

Reply via email to