#! /usr/bin/env ruby
filepath = "chapter1.xhtml"
text = File.read(filepath)
i=1
text = File.read(filepath)
while i!=91
replace = text.gsub(/123123/) do |match|
match=i.to_s()
end
File.open(filepath, "w") {|file| file.puts replace}
i=i+1
end
내가 Ruby1이 Ruby2는, Ruby3 하지만 내 코드가 작동하지 않습니다에 Ruby1, Ruby1, Ruby1를 교체합니다. 내 잘못은 어디에 있으며 어떻게 해결할 수 있습니까?문자열 int로 교체
예
를 들어Ruby1 Ruby1 Ruby1
는
코드는 작동하지만 희망하지 않습니다 – SemihY
3 줄의 입력 파일을 제공하십시오. 더 이상의 정보 없이는 도움이되지 않습니다. – user1852994
입력 파일 <섹션 ID = "bolum1"> <섹션 ID = "bolum1"> I 원하는 <섹션 ID = "bolum1"> <섹션 ID = "bolum2">에 – SemihY