# Save a file
f.write(str)
# Read a file
f.read
# Trim whitespace
" foo ".strip
# Print anything
puts 1 # even numbers!
puts File.open("foo", "w+") # even file handles!
puts [1, 2, 3, 4] # even arrays!
puts [].class # even classes!
puts [].method(:size) # even functions!
# Dump an array (see above)
Python is similarly clear:
# Save a file
f.write(str)
# Read a file
f.read()
# Trim whitespace
" foo ".strip()
# Print anything
print 1 # even numbers!
print open("foo", "w+") # even file handles!
print [1, 2, 3, 4] # even arrays!
print [].__class__ # even classes!
puts [].remove # even functions!
# Dump an array (see above)
Ruby and Python are extremely well documented. They have great standard libraries which wrap existing C functions too...and wrap them in a consistent fashion. They are also the second and third most popular language on Github, respectively...which means tons of great libraries to solve almost any problem you can think of.
Not sure about the Python ones, but the Ruby read/write file examples aren't quite fully done/correct here:
# Equivalent of file_put_contents() in PHP
# This could also be used for appending if the correct mode is specified.
File.open("filename", "w") { |f| f.write("some data") }
# Equivalent of file_get_contents() in PHP
some_var = File.read("filename")
Ruby and Python are just as easy to use as PHP.