Re: python

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Fries
Date:  
To: Main PLUG discussion list
Subject: Re: python
%s will be the placeholder for a string and %d for a number. If you used
say 15 as the value, and the template is %s you will get 15.to_s and is the
value was "15" and the template was %d, the value will be "15".to_i. In
other words it will try to do the appropriate conversion. So given your
example it worked. But let's say your template was %d, if you pass as a
value 15 or "15" that would work, but "fifteen" will throw an error. %s
will work, in all cases, but may not be what you want.

HTH
Kevin
On Oct 11, 2014 1:35 PM, "Michael Havens" <> wrote:

> Well, I've decided to try to learn python. Right now I'm on 'format
> string'.So there are different ones, right? Well, I'm working with %d and
> %s right now and if I change the %d to a %s I get the same result when I
> run the program. My question is %x just a place holder or do they have
> special meanings?
> :-)~MIKE~(-:
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss