Pass Keyword Arguments

The Python® built-in print function has keyword arguments, sep, end, and file.

print(*objects, sep=' ', end='\n', file=sys.stdout)

The following examples use the default value for file.

Create some text variables.

x1 = py.str('c:');
x2 = py.os.curdir;
x3 = py.os.getenv('foo');
py.print(x1,x2,x3)
c: . None

To display the values on separate lines, use newline, \n, as a separator.

py.print(x1,x2,x3,pyargs('sep',sprintf('\n')))
c:
.
None

Use the following statement to change sep to an empty string and change the end value to display THE END.

py.print(x1,x2,x3,pyargs('end', sprintf(' THE END\n'),'sep',py.str))
c:.None THE END

See Also

Related Topics

External Websites