PageRenderTime 38ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/python/varargs/runme.py

#
Python | 34 lines | 11 code | 16 blank | 7 comment | 2 complexity | db498f4a867c2293f81979c17ebe03a6 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. # file: runme.py
  2. import sys
  3. import example
  4. # Call printf
  5. example.printf("Hello World. I'm printf\n")
  6. # Note: We call printf, but use *python* string formatting
  7. for i in range(0,10):
  8. example.printf("i is %d\n" % i)
  9. # This will probably be garbled because %d is interpreted by C
  10. example.printf("The value is %d\n")
  11. # Call fprintf
  12. example.fprintf(sys.stdout,"Hello World. I'm fprintf\n")
  13. for i in range(0,10):
  14. example.fprintf(sys.stdout,"i is %d\n" % i)
  15. # This won't be garbled since %d is not interpreted
  16. example.fprintf(sys.stdout,"The value is %d\n")
  17. # This function calls our NULL-terminated function
  18. example.printv("Hello","World","this","is","a","test.")