How to do a newline in output

前端 未结 4 1861
时光取名叫无心
时光取名叫无心 2020-12-23 00:02

How do I make \\n actually work in my output? At the moment it just writes it all in 1 long block. Thanks for any help

Dir.chdir \'C:/Users/name         


        
4条回答
  •  醉梦人生
    2020-12-23 00:44

    Actually you don't even need the block:

      Dir.chdir 'C:/Users/name/Music'
      music = Dir['C:/Users/name/Music/*.{mp3, MP3}']
      puts 'what would you like to call the playlist?'
      playlist_name = gets.chomp + '.m3u'
    
      File.open(playlist_name, 'w').puts(music)
    

提交回复
热议问题