employees.txt Jim, Sales Andy, Sales Kelly, Customer Service Creed, Quality Assurance Michaes, Manager
File.open("employees.txt","r") do |file|
puts file.read()
end
Jim, Sales Andy, Sales Kelly, Customer Service Creed, Quality Assurance Michaes, Manager
puts file.read().include? "Jim"
true
puts file.readline()
Jim,sales
puts file.readline() puts file.readline()
Jim,Sales Andy,Sales
puts file.readchar() puts file.readchar() puts file.readchar()
J i m
puts file.readlines()
Jim, Sales Andy, Sales Kelly, Customer Service Creed, Quality Assurance Michaes, Manager
puts file.readlines()[2]
Kelly, Customer Service
for line in file.readlines() puts line end
Jim, Sales Andy, Sales Kelly, Customer Service Creed, Quality Assurance Michaes, Manager
file = File.open("employees.txt","r")
puts file.read
file.close()
Jim, Sales Andy, Sales Kelly, Customer Service Creed, Quality Assurance Michaes, Manager
Recommended Posts