|
File.open("songdata") do |song_file|
songs=SongList.new
song_file.each do |line|
file,length,name,title=line.chomp.split(/\s*\|\s*/)
songs.append(Song.new(title,name,length))
end
puts song[1]
end
怎么打开这个文件,在doc下怎么运行
("songdata") 中内容:
/jazz/j00132.mp3 |3:45| Fats Waller | Ain't Misbenhaving'
/jazz/j00319.mp3 |2:58| Louis Armstrong |Wonderful World
/bgrass/bg0732.mp3|4:09| Stringth in Numbers |Texas Red |
|