reading a file...

Cliff Wells clifford.wells at comcast.net
Wed Oct 20 08:38:04 EDT 2004


On Wed, 2004-10-20 at 07:30 +0000, Sandeep Avinash Gohad wrote:
>   
> Hello
> 
> I opened a file in a read mode
> 
> a=open('c:/a.bd4', 'r')
> print a
> a.read()
> 
> (This .bd4 format is not known for me.)

http://filext.com/detaillist.php?extdetail=BD4

> This gives the following output :

<snip>

> so i can not read that file,according to me the data is in the hexadecimal format

There is no such thing as 'hexadecimal format'.  It's a binary file
(i.e. not a text file).  The hex numbers you see are simply Python's way
of displaying non-ascii information in a useful way.

> please tell me how to read this data and convert it into long datatype
> and then copy the data and save it into .csv file.

Without knowing the format of the file you are not going to get very
far.  You can certainly take the contents of that file and make it into
a csv file, but I doubt that it's going to do you much good.

Regards,
Cliff

-- 
Cliff Wells <clifford.wells at comcast.net>




More information about the Python-list mailing list