About 165,000 results
Open links in new tab
  1. python - How can I print multiple things (fixed text and/or variable ...

    If you rename, remove or add any debugged variables, this print line will remain correct; Don't worry about alignment. If you have multiple variables, is the 4-th argument score or age? Well, …

  2. python - How can I print multiple things on the same line, one at a ...

    Apr 8, 2011 · Python 3 Solution. The print() function accepts an end parameter which defaults to \n (new line). Setting it to an empty string prevents it from issuing a new line at the end of the line.

  3. printing - Print variable and a string in python - Stack Overflow

    Printing string with variables . a = 1 b = "ball" print("I have", a, b) Versus printing string with functions. a = 1 b = "ball" print("I have" + str(a) + str(b)) In this case, str() is a function that …

  4. python - print multiple variables in a string what is the correct ...

    Feb 3, 2014 · I am just getting started with python. I have experience with some other languages I was just curious what the correct syntax would be to print the output of multiple variables in a …

  5. Printing multiple variables in a separate lines using a single print

    print(string1, string2, sep='\n') In python2: print string1 + '\n' + string2 ... or from __future__ import print_function and use python3's print. Since my first answer, OP has edited the question with …

  6. How can I print variable and string on same line in Python?

    File "print_strings_on_same_line.py", line 16 print fiveYears ^ SyntaxError: Missing parentheses in call to 'print' Then, I modified the last line where it prints the number of births as follows:

  7. How do I create a multiline Python string with inline variables ...

    Apr 12, 2012 · You can use Python 3.6's f-strings for variables inside multi-line or lengthy single-line strings. You can manually specify newline characters using \n . Variables in a multi-line string

  8. Print multiple lines with variables in a single print() statement in …

    Jun 26, 2014 · Python 3: Printing multiple variables on different lines. 1. ... How do I print multiple variables in a ...

  9. Using variables in the format() function in Python

    Sep 5, 2015 · Last but not least, of Python 3.6 and up, you can put the variables directly into the string literal by using a formatted string literal: f'Number {i}: {num:{field_size}.2f}' The …

  10. python - Write multiple variables to a file - Stack Overflow

    Then, for such simple formatting, you can use print, for Python 2.x ... Python output multiple variables ...

Refresh