(1..100).each do |i|
printf "\r%s", "[" + "#" * i + "\s" * (100 - i) + "]" + "(#{i}/100)"
sleep1
end
$stdout.flush

以后写脚本可以用上
(1..100).each do |i|
printf "\r%s", "[" + "#" * i + "\s" * (100 - i) + "]" + "(#{i}/100)"
sleep1
end
$stdout.flush
以后写脚本可以用上
本文标题:ruby的脚本怎么输出一个进度条
本文链接:https://www.haomeiwen.com/subject/pvqghxtx.html
网友评论