From: "林彰史" Date: 2012-12-12T20:51:05+09:00 Subject: Re: Enumerable#zip with File IO --bcaec53d5a9fae7b0204d0a669e1 Content-Type: text/plain; charset=ISO-8859-1 Yes I agree that it makes no sense, but I wanted to see how zip method works with File IO with a simple experimental code. My point is why the second line of input is discarded. 2012/12/12 Jan E. > Hi, > > this simply makes no sense. When you go through each line "by hand", the > "zip" is completely useless. You might as well write > > file = open( ARGV[0], "r" ) > puts "#{1}: #{file.readline}" > puts "#{2}: #{file.readline}" > ... > > I guess what you actually want is something like this: > > File.foreach(ARGV[0]).with_index do |line, i| > puts "#{i + 1}: #{line}" > end > > -- > Posted via http://www.ruby-forum.com/. > > --bcaec53d5a9fae7b0204d0a669e1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Yes I agree that it makes no sense, but I wanted to see how zip method= works with File IO with a simple experimental code.
My point= is why the second line of input is discarded.
--bcaec53d5a9fae7b0204d0a669e1--