StringIO#bytes() : bytes() is a StringIO class method which returns the value of bytes of the stringIO.
Syntax: StringIO.bytes() Parameter: StringIO values Return: value of bytes of the stringIO.
Example #1 :
Ruby
require 'stringio'
a = StringIO. new ("geeksforgeeks")
puts "StringIO a :
puts "StringIO a bytes form :
|
Output :
StringIO a : geeksforgeeks
StringIO a bytes form : #
Example #2 :
Ruby
require 'stringio'
a = StringIO. new ("icancode")
puts "StringIO a :
puts "StringIO a bytes form :
|
Output :
StringIO a : icancode
StringIO a bytes form : #
Note : The Enumerator value can change as per the compiler and system.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!