473,289 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Deferred text formatting

bartonc
6,596 Expert 4TB
Did you know that it's perfectly legal to defer text formatting until you have the value(s) available? Watch this:
Expand|Select|Wrap|Line Numbers
  1. s = "%d apples plus %d apples equals %d apples."
  2.  
  3. yours = 3
  4. mine = 4
  5.  
  6. print s %(yours, mine, (yours + mine))
I had labored under the assumption that the format character required something to fill it at the time of assignment.
Oct 22 '07 #1
1 1228
bartonc
6,596 Expert 4TB
Expand|Select|Wrap|Line Numbers
  1. s = "%d apples plus %d apples equals %d apples."
  2.  
  3. yours = 3
  4. mine = 4
  5.  
  6. print s %(yours, mine, (yours + mine))
Of course, if this is done to far away (in lines of code) from the assignment, it's a bit tricky distinguishing this from a modulo (%) operation.
Oct 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: SK | last post by:
Is there a way to store HTML into a MySQL TEXT column, yet be able to search over textual content only? For example, if I store the following HTML snippet: <p>A very <em>small</em>...
1
by: Anthony Martin | last post by:
I've been reading the Java Language Specification, and in Chapter 16 there's an interesting topic called Definite Assignment. http://tinyurl.com/3fqk8 I'm wondering about the idea of "Deferred...
3
by: Bryan | last post by:
i was intrigued with a recently posted cookbook recipe which implements deferred results with decorators: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355651 the problem i see with...
8
by: Frank van Vugt | last post by:
Hi, If during a transaction a number of deferred triggers are fired, what will be their execution order upon the commit? Will they be executed in order of firing or alfabetically or...
7
by: news | last post by:
Recently our mail from our e-commerce site has been rejected by AOL due to an IP block because someone was using our PHP scripts to send spam. Well, I got that fixed. But our legitimate...
3
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to...
0
by: Jean-Paul Calderone | last post by:
On Mon, 5 May 2008 19:10:39 +0200, Terry Jones <terry@jon.eswrote: You can do this (if you replace `pass´ with `None´, anyway) or you can pass `consumeErrors=True´ to the `DeferredList´...
4
by: raylopez99 | last post by:
I'm reading a book that talks about how some operations, like LINQ queries, are "deferred execution" while other queries are "immediate execution". What is the difference? RL
0
by: dlouche | last post by:
I have a method that contains the linq query: var query = from c in db.Categories join pc in db.ProductsToCategories on c.ID equals pc.CategoryID where...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.