string - How to add text to python calculation? -


I'm trying to create it with the help of a python:

In a loop for one ( (I + (i + 2.5)) Text [i + (i * (i + 2.5))] Text

Result:

  Text 1+ (1 * (1 + 2.5) text 4.5 text text 2+ (2 * (2 + 2.5) lesson 11 text text 3+ (3 * ( 3 + 2.5)) Text 1 9.5 Text etc.  
  • Each i must have a different formatting
  • All code Should be in a commandline

I have made it

  Python-C "import locale; locale.setlocale (locale.lc_all, ''); print ('\ n' in the category (1, 10, 1)) to join (locale.format ('\%  

UPDATE Strong>:

With the help of the reply of Tanmeia Mehr, I have created this command:

  Python-C "import system, locale; [sys.stdout.write (' Text1 '+' \% .2f + (\% .2f * (\% .2f + 2.5)) '\% (i, i, i) +' text2 '+' \% .2f '\% (i + (I * (i + 2.5)) + + 'text3' + '\ n') for category (1,11,1)] " 

but still me Not know

I think it will help, please specify that something Also to be added

  dragon - "import locale; Locale.setlokel (locale.LC_ALL, ''); Print ('\ n'.join (' text1 '+ Locale.format_string ('%. 1f + (%. 1f * (% 1f + 2.5)) ', (i, i, i), group = true) +' Text2 '+ locale.format_string ('% .1f ', I + (i * (i + 2.5), grouping = tru) +' in range for 'text3' (1,1111)) " < / Pre> 

Output:

  text1 1.0+ (1.0 * (1.0 + 2.5)) text 2 4.5 text3 text1 2.0+ (2.0 * (2.0 + 2.5)) Lesson 2 11.0 text3 text1 3.0+ (3.0 * (3.0 + 2.5)) text 2 19.5 text3 text1 4.0+ (4.0 * (4.0 + 2.5)) text 2 30.0 text3 text1 5.0+ (5.0 * (5.0 + 2.5 ) Text 2 42.5 Text 3 text1 6.0+ (6.0 * (6.0 + 2.5)) Lesson 2 57.0 Text3 text1 7.0+ (7.0 * (7.0 + 2.5)) Text 2 73.5 T Text 3 9.0+ (9.0 * (9.0 + 2.5)) Text2 112.5 Text3 Text1 10.0+ (10.0 * (10.0 + 2.5) Text 3 Text1 8.0+ (8.0 * (8.0 + 2.5)) Lesson 2 92.0 Text 3 Text 1 9.0+ ) Text2 135.0 Text3 ... ... Text1 1,109.0+ (1,09.0 * (1,109.0 + 2.5)) Text2 12,33,762.5 Text3 Text1 1,110.0+ (1,110.0 * (1,110.0 + 2.5)) Text 2 12,359 85.0 Text 3  

If you do not want a grouping, i.e., <, D> 12,35,985.0 format (comma with); So just remove group = true from code.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -