huh? Python says that AttributeError: 'string' object has no
Mikael Olofsson
mikael at isy.liu.se
Wed Apr 26 05:32:07 EDT 2000
On 26-Apr-00 schmitthead at my-deja.com wrote:
> I received a whole folder full of files with MacOS type text files, with
> different newline characters. I thought, a perfect job for python.
> Below is my attempt, but it generates the following error message:
>
> >mac2dos tt_prvt.h
> Traceback (innermost last):
> File "C:\bin\mac2dos.py", line 33, in ?
> mac2dos( directory )
> File "C:\bin\mac2dos.py", line 24, in mac2dos
> os.path.walk( os.getcwd(), callbackfunc, '' )
> File "d:\python\Lib\ntpath.py", line 265, in walk
> func(arg, top, names)
> File "C:\bin\mac2dos.py", line 18, in callbackfunc
> mac2dosfile( file )
> File "C:\bin\mac2dos.py", line 9, in mac2dosfile
> lines = myline.split( myline, chr(10) )
> AttributeError: 'string' object has no attribute 'split'
The line should be
lines = string.split( myline, chr(10) )
^^^^^^
split is a function in the module string.
/Mikael
-----------------------------------------------------------------------
E-Mail: Mikael Olofsson <mikael at isy.liu.se>
WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael
Phone: +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
Date: 26-Apr-00
Time: 11:29:45
This message was sent by XF-Mail.
-----------------------------------------------------------------------
More information about the Python-list
mailing list