【文件属性】:
文件名称:python.rb:Ruby中的Python
文件大小:23KB
文件格式:ZIP
更新时间:2021-05-22 19:37:58
Ruby
Python
Python在没有任何库的纯Ruby中实现。
安装
将此行添加到您的应用程序的Gemfile中:
gem 'python'
然后执行:
$ bundle
或将其自己安装为:
$ gem install python
用法
可执行脚本“ python.rb”将安装在您的bin路径中。 您可以通过两种方式执行python程序。 一种方法是通过命令行解释器(REPL),另一种方法是从源文件。
命令行解释器(REPL)
$ python.rb
python.rb> 1 + 2
3
python.rb>
从源文件执行程序
# demo.py
class A :
def __init__ ( self , x ):
self . x = x
def add ( self , d ):
self . x = self .
【文件预览】:
python.rb-develop
----LICENSE.txt(1KB)
----lib()
--------python.rb(212B)
--------python()
----Gemfile(91B)
----spec()
--------spec_helper.rb(17B)
--------python()
----Rakefile(29B)
----examples()
--------demo.py(179B)
--------fibonacci.py(111B)
--------twoclass.py(152B)
----python.gemspec(873B)
----README.md(1KB)
----features()
--------programmer_use_advanced_calculator.feature(1KB)
--------programmer_use_variables.feature(358B)
--------programmer_starts_repl_console.feature(270B)
--------programmer_use_closure.feature(2KB)
--------programmer_caclulate_numerical_expression.feature(2KB)
--------programmer_use_class.feature(1014B)
--------step_definitions()
--------programmer_execute_from_source_file.feature(306B)
--------support()
----.gitignore(129B)
----bin()
--------python.rb(338B)