[Tutor] To write data in two different fonts?
Kent Johnson
kent37 at tds.net
Tue Aug 11 12:50:34 CEST 2009
On Tue, Aug 11, 2009 at 5:24 AM, prasad rao<prasadaraon50 at gmail.com> wrote:
> 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()
Plain text files don't have style information. You have to write
structured data such as HTML or PDF. HTML is probably the simplest.
Kent
More information about the Tutor
mailing list