print

From DavinciWiki
Jump to: navigation, search


64-bit SafeYes

Description

Print output to a stream

Arguments and Return Values

Arguments: objects to print

Return Value: None.

Usage

Syntax: print(arg1 [, arg2, arg3 ...] [sep=STRING, end=STRING, file=STRING])

The print() function is based on the python3 print() function. You can pass as many arguments of whatever type you want and it will print them, separated by sep, with the end string at the end.

sep defaults to " ". end defaults to "\n". file defaults to stdout.

If file is provided, it will be opened in append mode same as fprintf.

Note that the keyword arguments can be given in any order, anywhere in the call, even interspersed with regular arguments.

Note that this prints complex objects (structures, text objects, 3D arrays) similar to the way that dump does except without a depth limit for arrays or structs. When combined with sep, that can look off.

The best way to use print in those cases is to set sep="" and pass space and newlines as you want, or just print complex structures separately. See the example.

Examples

 dv> b = create(2,3,2)
 2x3x2 array of int32, bsq format [48 bytes]
 0    1   
 2    3   
 4    5   

 6    7   
 8    9   
 10   11   

 dv> print(100, b, 300)
 100 0    1
 2    3
 4    5

 6    7
 8    9
 10   11 300

 dv> print(100, '\n', b, '\n', 300, sep='')
 100
 0    1
 2    3
 4    5

 6    7
 8    9
 10   11
 300

dv> c = { a = 1, b = 2 }
struct, 2 elements
    a: 1
    b: 2
dv> dump(c)
struct, 2 elements...
dv> print(c)
    a: 1
    b: 2

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Core Changes

Modified On: 11-19-2016

Personal tools