From: "Mark Smith" <Mark.Smith@capital-fx.co.uk> Subject: RE: Using Rush in a slightly different way [for Framecycler] Date: Wed, 14 Sep 2005 03:06:17 -0700 |
Msg# 1033 View Complete Thread (2 articles) | All Threads Last Next |
Ah de old Python O'Reilly book... I probably would have done it something like: bgcolor = "#222255" fgcolor = "#ffffff" htmlstr = "<html>" + "\n" htmlstr += "<body bgcolor=%(bgcolor)s>" + "\n" htmlstr += "<font color=%(fgcolor)s>Testing</font>" print htmlstr % locals() Hadn't thought of doing it with """s. Hardly ever use them. Saves having to stick in the "\n" I guess but I quite like having things in variables as so I can pass them around easily. Depends on the circumstance I guess. Mark -----Original Message----- From: Greg Ercolano [mailto:erco@(email surpressed)] Sent: 14 September 2005 04:23 To: void@(email surpressed) Subject: Re: Using Rush in a slightly different way [for Framecycler] [posted to rush.general] > I've sent you a separate email to this one with attached the command > line documentation for sequence publisher and a list of the subset of > options we are interested in here to save you as much work as possible! Yes, received -- I'll check it out. > A simple Python submit script would be brilliant...I'm afraid Perl sends > shivers up my spine. As soon as I learn enough of python, I'll post something ;) I've been flipping through the O'Reilly book. The 'here document' stuff had me guessing for a while, but I think I've got it solved with: bgcolor = "#222255" fgcolor = "#ffffff" print """ <html> <body bgcolor=%(bgcolor)s> <font color=%(fgcolor)s>Testing</font> """ % locals() If there's a better way to embed variables in """'ed text, let me know. -- Greg Ercolano, erco@(email surpressed) Rush Render Queue, http://seriss.com/rush/ Tel: (Tel# suppressed) Cel: (Tel# suppressed) Fax: (Tel# suppressed) |
From: Greg Ercolano <erco@(email surpressed)> Subject: Re: Using Rush in a slightly different way [for Framecycler] Date: Wed, 14 Sep 2005 12:42:53 -0700 |
Msg# 1034 View Complete Thread (2 articles) | All Threads Last Next |
Mark Smith wrote: Hadn't thought of doing it with """s. Hardly ever use them. The """'s are useful when you have 100's lines of html, or in the case of rush, 100's of lines of GUI description text that's being piped to the rush 'input' program. python's """ syntax is similar to the csh/sh/perl/ruby 'here document' syntax which is usually of the form: cat << EOF Lots of lines of stuff here.. one two three four five six EOF ..that being a CSH example. Saves having to stick in the "\n" I guess ..and all the '"'s and '+'s ;) but I quite like having things in variables as so I can pass them around easily. The """ syntax works with variables too, eg: some_variable = """ Lots of lines of stuff here.. one two three four five six """ That being the equivalent of: some_variable = "\n" + " Lots of lines of stuff here..\n" + " one two three\n" + " four five six\n" + "\n" -- Greg Ercolano, erco@(email surpressed) Rush Render Queue, http://seriss.com/rush/ Tel: (Tel# suppressed) Cel: (Tel# suppressed) Fax: (Tel# suppressed) |