[Tutor] To write data in two different fonts?

prasad rao prasadaraon50 at gmail.com
Tue Aug 11 11:24:20 CEST 2009


Hello
     I am wtriting some dat on to a file in which
headings should be of different size than other data.
Is it possible?If possible please tell me how to do it.

<code>

def sc(adir):
      import os,myfiles
      dest=open('C:/scripts.txt','w')
      s=myfiles.myfiles(adir)
      for x in s:
             if os.path.isfile(x):
                 sorce=open(x,'r')
                 data=sorce.readlines()
                 dest.write(x+'\n','bold')

                 dest.write(('-'*len(x))+'\n')
                 for l in data:
                      dest.write(l)
                 sorce.close()
           else:pass
   dest.close()


>>> sc('C:\Python26\mscripts')

Traceback (most recent call last):
  File "<pyshell#69>", line 1, in <module>
    sc('C:\Python26\mscripts')
  File "<pyshell#68>", line 9, in sc
    dest.write(x+'\n','bold')
TypeError: function takes exactly 1 argument (2 given)

</code>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090811/b7a19129/attachment.htm>


More information about the Tutor mailing list