我如何让\n
在我的输出中实际工作?目前它只是把它写在1个长块中。感谢您的帮助如何在输出中执行换行
Dir.chdir 'C:/Users/name/Music'
music = Dir['C:/Users/name/Music/*.{mp3, MP3}']
puts 'what would you like to call the playlist?'
@new = ''
playlist_name = gets.chomp + '.m3u'
music.each do |z|
@new += z + '\n'
end
File.open playlist_name, 'w' do |f|
f.write @new
end
感谢您的回答,让我看起来像一个傻瓜,但至少我现在知道 – babyrats 2010-01-13 21:18:35
对自己不要太难:唯一的学习方法是提问。 – 2010-01-13 21:58:20
@babyrats - 你不是唯一一个:) – Ninad 2011-09-14 10:57:07