Comparison between scala script and python script
To print file’s contents line by line, you can use some programming languages to write scripts:
bash shell, python, scala, ruby …
I am familiar with bash, python, scala, java, so I try use these to write scripts.
bash
Bash is too complex to write this type script. So I give up to write by bash.python
It’s good enough to do this thing.scala
I love scala, so I will try to use scala to write. And scala is so smart.java
No way.
1. Python Script
1 | // test.py |
execute it:1
python3 test.py
2. Scala Script
1. General type
1 | //Test.scala |
execute it:1
2scalac Test.scala
scala Test
2. Scala Shell Script
1 | //Test.sh |
execute it:1
2chomod 770 Test.sh
./Test.sh
Summary
If you are familiar with python, I think you will glad to use python than scala to write this script.
It is so easy and powerful.
If not familiar with python, you can use scala too.
Of course, you can use ruby and other script languages.