Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: problem with % operator on format string

Reply
Thread Tools

Re: problem with % operator on format string

 
 
vivek@cs.unipune.ernet.in
Guest
Posts: n/a
 
      06-26-2003
On Thu, Jun 26, 2003 at 04:04:23AM +0200, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>
> hello,
> i just subscribed to this list, so first i'd like to greet all of you
> i've recently discovered this great language and now i'm coding alot in
> it. today i ran into some problem with % operator on strings.
>
> i have some database query, which i want to format nicely. it looks like:
>
> query = "select date(xxx, '\%d') from yyy where xxx
> like '%s%s\%'" % (year, month)
>
> so it should produce something like that (year=2003, month=06)
>
> select date(xxx, '%d') from yy where xxx like '200306%'
>
> arguments, even if i (as you see) use an escape character '\' before %d.


use '%%d' instead of '\%d'

regrads
Vivek Kumar

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: raw format string in string format method? Chris Angelico Python 3 03-01-2013 12:00 AM
Re: raw format string in string format method? Rick Johnson Python 0 02-28-2013 11:06 PM
Re: raw format string in string format method? Peter Otten Python 0 02-28-2013 03:41 PM
Simple error : method format(String, Object[]) is not applicable for the arguments (String, String) ankur Java 1 08-27-2007 06:31 AM
Date Format - best way of converting a string into a date format Brian Candy ASP .Net 2 02-18-2004 02:13 PM



Advertisments