Tom Plunket wrote:
> I know that the message didn't have enough formatters, that's why I
> asked. (Although I would have assumed that the generator would get
> automatically converted to a sequence that was consumable by the
> interpolation operator...)
That's because::
aFormatString %
Erik Max Francis wrote:
> > For enrichment purposes, is there a way to do this sort of thing with
> > a generator? E.g. something like:
> >
> > def SentenceGenerator():
> >words = ['I', 'have', 'been', 'to', 'the', 'fair']
> >for w in words:
> > yield w
> >
> > message = "%s %s %
Tom Plunket wrote:
> Excellent. Thanks. Has this been around long? I "learned" Python in
> the 1.6 days iirc, but haven't done much except simple scripting with
> it since...
Yep. Been around since at least 1.5.x.
--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San
Justin Azoff wrote:
> Of course..
>
> I should read the python documentation at
> http://docs.python.org/lib/typesseq-strings.html
Excellent. Thanks. Has this been around long? I "learned" Python in
the 1.6 days iirc, but haven't done much except simple scripting with
it since...
-tom!
--
h
- Original
Message -From: "Tom Plunket" <[EMAIL PROTECTED]>Newsgroups: comp.lang.pythonTo: <python-list@python.org>Sent: Friday, July 14, 2006 12:49 AMSubject: String handling
and the percent operator> I have some code to autogenerate some
boilerplate code so
Tom Plunket wrote:
> I have some code to autogenerate some boilerplate code so that I don't
> need to do the tedious setup stuff when I want to create a new module.
>
> So, my script prompts the user for the module name, then opens two
> files and those files each get the contents of one of these
Tom Plunket wrote:
> Simon Forman wrote:
>
> > strings have a count() method.
>
> thanks!
>
> For enrichment purposes, is there a way to do this sort of thing with
> a generator? E.g. something like:
>
> def SentenceGenerator():
>words = ['I', 'have', 'been', 'to', 'the', 'fair']
>for w in
Justin Azoff wrote:
> Tom Plunket wrote:
>> boilerplate = \
>> """
> [big string]
>> """
>>
>> return boilerplate % ((module,) * 3)
>>
[deletia...]
> Of course..
>
stuff = {'lang': 'python', 'page': 'typesseq-strings.html'}
print """I should read the %(lang)s documentation at
Tom Plunket wrote:
> boilerplate = \
> """
[big string]
> """
>
> return boilerplate % ((module,) * 3)
>
> My question is, I don't like hardcoding the number of times that the
> module name should be repeated in the two return functions. Is there
> an straight forward (inline-appropria
Tom Plunket wrote:
> For enrichment purposes, is there a way to do this sort of thing with
> a generator? E.g. something like:
>
> def SentenceGenerator():
>words = ['I', 'have', 'been', 'to', 'the', 'fair']
>for w in words:
> yield w
>
> message = "%s %s %s %s"
>
> print messag
Simon Forman wrote:
> strings have a count() method.
thanks!
For enrichment purposes, is there a way to do this sort of thing with
a generator? E.g. something like:
def SentenceGenerator():
words = ['I', 'have', 'been', 'to', 'the', 'fair']
for w in words:
yield w
message = "%s %
Tom Plunket wrote:
> I have some code to autogenerate some boilerplate code so that I don't
> need to do the tedious setup stuff when I want to create a new module.
>
> So, my script prompts the user for the module name, then opens two
> files and those files each get the contents of one of these f
I have some code to autogenerate some boilerplate code so that I don't
need to do the tedious setup stuff when I want to create a new module.
So, my script prompts the user for the module name, then opens two
files and those files each get the contents of one of these functions:
def GetPyContents
13 matches
Mail list logo