My current code is:  for i in range(len(phoneList)):     print("|{}|{}|{}|{}|".format(formattedPhoneList[i],namesList[i],number[i], lastDue[i]))     if float(lastDue[i]) &gt; 850:         print("**")     elif float(lastDue[i]) &lt; 850 and int(number[i]) &gt; 350:         print("++")     else:         continue   Desired Output would be:  |Index[0] of formattedPhoneList|Name Index[0]|384|$ 976.97|** |Index[1] of formattedPhoneList|Name Index[1]|132|$ 188.81| |Index[2] of formattedPhoneList|Name Index[2]|363|$ 827.48|++   Current Output:   |Index[0] of formattedPhoneList|Name Index[0]|384|$ 976.97| ** |Index[1] of formattedPhoneList|Name Index[1]|132|$ 188.81| |Index[2] of formattedPhoneList|Name Index[2]|363|$ 827.48| ++   I have tried inserting a trailing comma and import stdout with no success. Is there another way to format this? Thank you for reading.
3114
I'd like to do it in Python. What I'd like to do in this example in C: #include &lt;stdio.h&gt;  int main() {     int i;     for (i=0; i&lt;10; i++) printf(&quot;.&quot;);     return 0; }  Output: ..........  In Python: &gt;&gt;&gt; for i in range(10): print('.') . . . . . . . . . . &gt;&gt;&gt; print('.', '.', '.', '.', '.', '.', '.', '.', '.', '.') . . . . . . . . . .  In Python print will add a \n or space, how can I avoid that? Now, it's just an example, don't tell me I can first build a string then print it. I'd like to know how to &quot;append&quot; strings to stdout.
12144
Not too well up on LaTeX, but I want to use the listings package for listings spanning a two-column format.  Unfortunately, asterisks cannot save me (like for figures/tables); this doesn't work:  \begin{lstlisting*} ... \end{lstlisting*}   I've Googled about, but got no satisfactory answer, and getting a bit desperate. Should be simple... hope I'm not missing something stupid. Perhaps it's possible to embed this into a separate spanning float?  Help?  (P.S., I've posted this on the main stackoverflow site as well...  if this is considered a duplicate, please comment and I'll remove the other. Getting a bit desperate fighting a deadline.)
100626
For example {a..c}{1..3} expands to a1 a2 a3 b1 b2 b3 c1 c2 c3.   If I wanted to print a1 b1 c1 a2 b2 c2 a3 b3 c3, is there an analogous way to do that? What's the simplest way?
40121
I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable.  I was thinking:  String.Format("{0:###-###-####}", i["MyPhone"].ToString() );   but that does not seem to do the trick.  ** UPDATE **  Ok. I went with this solution  Convert.ToInt64(i["Customer Phone"]).ToString("###-###-#### ####")   Now its gets messed up when the extension is less than 4 digits. It will fill in the numbers from the right. so  1112224444 333  becomes  11-221-244 3334   Any ideas?
12628
Is there a benefit to using one over the other? In Python 2, they both seem to return the same results:  &gt;&gt;&gt; 6/3 2 &gt;&gt;&gt; 6//3 2
3799
How do I access the index in a for loop like the following?  ints = [8, 23, 45, 12, 78] for i in ints:     print('item #{} = {}'.format(???, i))   I want to get this output:  item #1 = 8 item #2 = 23 item #3 = 45 item #4 = 12 item #5 = 78   When I loop through it using a for loop, how do I access the loop index, from 1 to 5 in this case?
26743
How can I format my output in C++? In other words, what is the C++ equivalent to the use of printf like this:  printf("%05d", zipCode);   I know I could just use printf in C++, but I would prefer the output operator &lt;&lt;.  Would you just use the following?  std::cout &lt;&lt; "ZIP code: " &lt;&lt; sprintf("%05d", zipCode) &lt;&lt; std::endl;
94875
I want to print list of numbers from 1 to 100 and I use a for loop like the following:  number=100 for num in {1..$number} do   echo $num done   When I execute the command it only prints {1..100} and not the list of number from 1 to 100.
80374
If I have this string:     2+24*48/32   what is the most efficient approach for creating this list:     ['2', '+', '24', '*', '48', '/', '32']
106641
How do I format a list of questions like this?     I'm getting the equation on a new line below the i) when using enumerate and \list.  I don't want to get rid of \[ and \] either as I like the long integral sign  I get this instead:
57835
says:  If the index number is @ or *, all members of an array are referenced.  When I do this: LIST=(1 2 3) for i in &quot;${LIST[@]}&quot;; do   echo &quot;example.$i&quot; done  it gives the desired result: example.1 example.2 example.3  But when I use ${LIST[*]}, I get example.1 2 3  instead. Why? Edit: when using printf, @ and * actually do give the same results.
82081
In LibreOffice Calc, if I have a column with a lot of numbers in this format 8,1 (comma), how  can I transfer all these numbers to the format 8.1 (dot)?  When I say "a lot" I mean thousands of numbers, so it is just impossible to rewrite it again in the right format.
2900
It's supposed to be zero but for some reason the result produces a peculiar series of digits at the end.  Also, here's the .xlsx of it: http://83.212.111.36/Book1.xlsx
109876
In , the votes clearly show that the os.path.splitext function is preferred over the simple .split('.')[-1] string manipulation. Does anyone have a moment to explain exactly why that is? Is it faster, or more accurate, or what? I'm willing to accept that there's something better about it, but I can't immediately see what it might be. Might importing a whole module to do this be overkill, at least in simple cases?  EDIT: The OS specificity is a big win that's not immediately obvious; but even I should've seen the "what if there isn't a dot" case! And thanks to everybody for the general comments on library usage.
28527
Consider the below file:   foo,boo,900 foo,boo,900 foo,boo,850   I need to compare the a field ($3) with the next record, if the difference is equal or more than 50, then print the record.   i.e from the sample above, $3 from second record - $3 from the third record = 50, then the output would be:   foo,boo,850
4177
Is there a way to step between 0 and 1 by 0.1?   I thought I could do it like the following, but it failed:  for i in range(0, 1, 0.1):     print i   Instead, it says that the step argument cannot be zero, which I did not expect.
120559
I'm storing an ArrayList of Ids in a processing script that I want to spit out as a comma delimited list for output to the debug log. Is there a way I can get this easily without looping through things?  EDIT: Thanks to Joel for pointing out the List(Of T) that is available in .net 2.0 and above. That makes things TONS easier if you have it available.