"Wijaya Edward" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hi,
>
> How can we slurp all content of a single file
> into one variable?
>
Please don't double-post your questions. Now you have two threads running
with people answering the same question.
-- Paul
--
http://m
Wijaya Edward wrote:
> Hi,
>
> How can we slurp all content of a single file
> into one variable?
>
> I tried this:
>
myfile_content = open('somefile.txt')
print myfile_content,
>
>
>
> But it doesn't print the content of the file.
>>> help(open)
Help on built-in function ope
Ben Finney <[EMAIL PROTECTED]> writes:
> The 'read' method of the resulting file object will return the
> contents of the file. You may also want to read the documentation of
> thile objects to see what else you can do with them.
And ith you couldn't underthtand my thpeetch impediment, I meanth
"
Wijaya Edward <[EMAIL PROTECTED]> writes:
> >>> myfile_content = open('somefile.txt')
> >>> print myfile_content,
>
> >>>
>
> But it doesn't print the content of the file.
That's right, because "the content of the file" is not what open() is
documented to return; it is documented as returning a
Wijaya Edward wrote:
> Hi,
>
> How can we slurp all content of a single file
> into one variable?
>
> I tried this:
>
>
myfile_content = open('somefile.txt')
print myfile_content,
>
>
>
>
>
> But it doesn't print the content of the file.
>
Because you haven't read it!
data
On 2006-10-27, Wijaya Edward <[EMAIL PROTECTED]> wrote:
> How can we slurp all content of a single file
> into one variable?
http://docs.python.org/tut/node9.html#SECTION00920
I suggest you read the rest of the tutorial as well.
--
Grant Edwards grante
Hi,
How can we slurp all content of a single file
into one variable?
I tried this:
>>> myfile_content = open('somefile.txt')
>>> print myfile_content,
>>>
But it doesn't print the content of the file.
Regards,
-- Edward WIJAYA
SINGAPORE
Institute For Infocomm Research -