摘要: win7上同时装了py2和py3,在ST3中执行需要分别新建各自的build system:Tools->Build System->New Build System py2: py3: 阅读全文
posted @ 2017-03-02 12:42 LUCIEN06 阅读(151) 评论(0) 推荐(0)
摘要: 1 #求阶乘方法一 2 def f1(n) 3 if n == 1 4 return 1 5 else 6 return n * f1(n-1) 7 end 8 end 9 10 #求阶乘方法二 11 def f2(n) 12 i = 1 13 while n > 0 14 i *= n 15 n -= 1 16 ... 阅读全文
posted @ 2016-09-21 22:59 LUCIEN06 阅读(259) 评论(0) 推荐(0)
摘要: frequency = Hash.new(0)output = File.open('test_frequency.txt', 'w')File.open('test.txt', 'r') do |input| input.read.downcase.scan(/\b[a-z]{3,16}\b/)... 阅读全文
posted @ 2015-09-16 01:06 LUCIEN06 阅读(175) 评论(0) 推荐(0)
摘要: The 'require' method will not look in the current directory for files to load(but you can userequire './test.rb' to look in the current directory), bu... 阅读全文
posted @ 2015-05-29 16:44 LUCIEN06 阅读(102) 评论(0) 推荐(0)
摘要: output = (input < 0) ? 0 : input 等同于:if input < 0 output = 0else output = inputend等同于:output = inputoutput = 0 if input < 0 阅读全文
posted @ 2015-05-29 15:42 LUCIEN06 阅读(107) 评论(0) 推荐(0)
摘要: windows上irb清屏:system('cls')谷哥说在windows的如下路径下可找到.irbrc文件,但硬是没找到。on Windowsc:\users\yourusername\.irbrcOR%userprofile%/.irbrc于是在bin目录(C:\Ruby193\bin)下创建... 阅读全文
posted @ 2015-05-26 11:36 LUCIEN06 阅读(244) 评论(0) 推荐(0)
摘要: map and collect are the same, theyreturn an array constructed as the result of calling the block for each item in the array.irb(main):002:0> [1,2,3,4]... 阅读全文
posted @ 2015-05-22 13:40 LUCIEN06 阅读(535) 评论(0) 推荐(0)
摘要: 判断软件卸载是否删除了所有相关的文件夹及文件1.假定要将软件安装到C盘,先在C盘创建文件inventory.rb,输出C盘下所有文件夹及文件包括子文件夹及子文件夹中文件。创建文件old_inventory.txt存放软件安装卸载前的文件列表,创建文件new_inventory.txt存放软件安装卸载... 阅读全文
posted @ 2015-05-22 10:33 LUCIEN06 阅读(129) 评论(0) 推荐(0)