Slurping All Content of a File into a Variable <Pls ignore, problem with mailing list, eom>

Wijaya Edward ewijaya at i2r.a-star.edu.sg
Fri Oct 27 02:56:03 EDT 2006


 

________________________________

From: python-list-bounces+ewijaya=i2r.a-star.edu.sg at python.org on behalf of Wijaya Edward
Sent: Thu 10/26/2006 11:47 PM
To: python-list at python.org
Subject: Slurping All Content of a File into a Variable




Hi,

How can we slurp content of a single file
into one variable?

I tried this:

>>> myfile_content = open('somefile.txt')
>>> print myfile_content,
<open file 'somefile.txt', mode 'r' at 0xb7f532e0>
>>>

But it doesn't print the content of the file.

Regards,
-- Edward WIJAYA
SINGAPORE


------------ Institute For Infocomm Research - Disclaimer -------------
This email is confidential and may be privileged.  If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.
--------------------------------------------------------
--
http://mail.python.org/mailman/listinfo/python-list



------------ Institute For Infocomm Research - Disclaimer -------------
This email is confidential and may be privileged.  If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.
--------------------------------------------------------



More information about the Python-list mailing list