About 120,000 results
Open links in new tab
  1. printing - Print variable and a string in python - Stack Overflow

    If the Python version you installed is 3.6.1, you can print strings and a variable through a single line of code. For example the first string is "I have", the second string is "US Dollars" and the variable …

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

    I am using python to work out how many children would be born in 5 years if a child was born every 7 seconds. The problem is on my last line. How do I get a variable to work when I'm printing text ...

  3. python - Print a variable's name and value - Stack Overflow

    print x # easy to type, but no context print 'x=',x # more context, harder to type 12 x= 12 How can write a function that will take a variable or name of a variable and print its name and value? I'm interested …

  4. python - How can I print multiple things (fixed text and/or variable ...

    I want it to print out Total score for Alice is 100, but instead I get Total score for %s is %s Alice 100. How can I get everything to print in the right order with the right formatting? See also: How can I print …

  5. How can I access environment variables in Python?

    I haven’t set it (PYTHONPATH) before; what I am doing just go with command prompt and type CMD anywhere (since python.exe is in my shell PATH). If I try to access Window ENVIRONMENT …

  6. python - How to assign print output to a variable? - Stack Overflow

    The print statement in Python converts its arguments to strings, and outputs those strings to stdout. To save the string to a variable instead, only convert it to a string:

  7. How can you print a variable name in python? [duplicate]

    That said, Python does have built-in namespaces. For example, locals () will return a dictionary mapping a function's variables' names to their values, and globals () does the same for a module.

  8. How do I determine the size of an object in Python?

    Just use the sys.getsizeof function defined in the sys module. sys.getsizeof(object[, default]): Return the size of an object in bytes. The object can be any type of object. All built-in objects will return correct …

  9. Printing variables in Python 3.4 - Stack Overflow

    print() is a function in Python 3, not a statement. Surround everything in your last line (except the word print) in parentheses and you'll be all set.

  10. How to print variable inside quotation marks? - Stack Overflow

    print repr(str(variable)) Otherwise, prefer the .format method over the % operator (see Hackaholic's answer). The % operator (see Bhargav Rao's answer) also works, even in Python 3 so far, but is …