3 ms·
Slightly modified so that it runs either a Ruby file or a Python one: (0 and eval(IO.read("ruby.rb"))) or eval(compile(open("python.py").read(), "", "exec"))
by SeekingMeaning 7y ago
Slightly modified so that it runs either a Ruby file or a Python one:
(0 and eval(IO.read("ruby.rb"))) or eval(compile(open("python.py").read(), "", "exec"))
Granted, this doesn’t close the Python file, which is delayed until garbage collection or program termination.
- coolreader18 7y agoYou could also do `__import__("/abs/path/to/python.py")` (I think, I'm not completely sure on the rules for passing paths to `__import__`)