[Tutor] a quick Q: how to use for loop to read a series of files with .doc end
lina.lastname at gmail.com
Sat Oct 8 18:20:03 CEST 2011
On Sat, Oct 8, 2011 at 10:50 PM, Alan Gauld <alan.gauld at btinternet.com>wrote:
> On 08/10/11 11:27, Alan Gauld wrote:
> What you want, I think, is to join the original list
>> with spaces(and maybe add a newline for writing to file)
>> summary = ' '.join(summary) + \n
> But you need to make the original items strings first
> so it should be:
> summary = ' '.join( map(str,summary) ) + \n
new_summary=' '.join( map(str,summary) ) + \n
SyntaxError: unexpected character after line continuation character
so I added it as
new_summary=' '.join( map(str,summary[1:-3]) ) + "\n"
but each one in summary does not show in new line.
This one works,
> Sorry about that,
Thanks for your suggestions.
> Alan G
> Author of the Learn to Program web site
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor