import sys
filenames = sys.argv[1:]
def fixline(filename):
text = open(filename).read()
text = text.replace('\n\r','\n')
return text
for file in filenames:
print fixline(file)
This is of course interesting. I have thought about this before: But wouldn't it be more interesting to use (say the orient) language's mindset to set, embedded into the language at its core?
I'm not sure I fully understand what you mean by "code sample from these languages", but Ruby's source has plenty of code contributed from all over the world https://github.com/ruby/ruby
Comments
While I can't read much of any CJK languages, I am interested in seeing code samples from these Chinese and Japanese programming languages.
Anyone know where to look? What obstacles or advantages does the character sets give these languages?
http://www.chinesepython.org/english/english.html
A simple Python program:
and its translation:Well, I ever! Didn't even realise something like this is even possible! :O
Is it the same for Cyrillic or German or Spanish for that matter?
Blown. Away.
This is of course interesting. I have thought about this before: But wouldn't it be more interesting to use (say the orient) language's mindset to set, embedded into the language at its core?
For instance, check 'Chinese Python' samples [1].
Besides CJK, there are several programming languages that based on non-English languages [2]. A few ones are even widely used in industry.
[1] http://www.chinesepython.org/doc/sample/ask.html
[2] http://en.wikipedia.org/wiki/Non-English-based_programming_l...
I'm not sure I fully understand what you mean by "code sample from these languages", but Ruby's source has plenty of code contributed from all over the world https://github.com/ruby/ruby
If you're talking about code written in non-English languages, Peter Cooper has a fun article about writing Ruby code in UTF-8: http://www.rubyinside.com/the-split-is-not-enough-whitespace...
This is right up there with naming functions in Emoji. There are a few in my current codebase that could be gladly replaced with beers, martinis, etc.