Using print instead of file.write(str)
John Machin
sjmachin at lexicon.net
Sat Jun 3 22:52:49 EDT 2006
More information about the Python-list mailing list
Sat Jun 3 22:52:49 EDT 2006
- Previous message (by thread): reordering elements of a list
- Next message (by thread): Using print instead of file.write(str)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/06/2006 9:47 AM, Bruno Desthuilliers wrote:
>
> Now, given:
>
> bird = "parrot"
> beautiful = "dead"
>
> How would you do the following with f.write() ?
>
> print "this", bird, "is", beautiful
>
> (without using string formating, of course...)
Like this:
f.write((' '.join(str(x) for x in ['this', bird, 'is', beautiful]) + '\n'))
... or was that a rhetorical question?
Cheers,
John
- Previous message (by thread): reordering elements of a list
- Next message (by thread): Using print instead of file.write(str)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list