Q:

Blender console formatted printing: Is there a maximum length?

With the default cube mesh and Blender 2.77, if I run this code in console:
for f in bpy.data.meshes['Cube'].polygons:
    for v in f.vertices:
        print("%f %f %f" % bpy.data.meshes['Cube'].vertices[v].co[:])
        print("%f %f %f" % f.normal[:])
    print("\n")     

I get the following output (truncated for brevity):
-1.000000 -1.000000 1.000000
-1.000000 0.000000 0.000000
-1.000000 1.000000 1.000000
-1.000000 0.000000 0.000000
-1.000000 1.000000 -1.000000
-1.000000 0.000000 0.000000
-1.000000 -1.000000 -1.000000
-1.000000 0.000000 0.000000

-1.000000 1.000000 1.000000
0.000000 1.000000 -0.000000
...

However, with this:
for f in bpy.data.meshes['Cube'].polygons:
    for v in f.vertices:
        print("%f %f %f %f %f %f\n" % bpy.data.meshes['Cube'].vertices[v].co[:], f.normal[:])
    print("\n")

or even this:
for f in bpy.data.meshes['Cube'].polygons:
    for v in f.vertices:
        print("%f %f %f %f %f %f" % bpy.data.meshes['Cube'].vertices[v].co[0], py.data.meshes['Cube'].vertices[v].co[1], py.data.meshes['Cube'].vertices[v].co[2], f.normal[0], f.normal[1], f.normal[2])
    print("\n")

I get the error:
Traceback (most recent call last):
  File "<blender_console>", line 3, in <module>
TypeError: not enough arguments for format string

Why can I print 3 floats easily but printing 6 floats doesn't work? Is Python's formatted printing different that C's (in this respect)? Or is it something Blender specific? Is there a maximum limit on how many 'arguments' the format string can take?

A:

In python the string formatting operation ('%') accepts a single argument and in your first (working) example that's exactly what you've got as it's a single element with 3 components. in your other (not working) examples you're trying to pass multiple values to '%', each containing 3 values. Your solution is to simply combine them into a single tuple by appending them with the '+' operator :

for f in bpy.data.meshes['Cube'].polygons:
    for v in f.vertices:
        print("%f %f %f %f %f %f\n" % (bpy.data.meshes['Cube'].vertices[v].co[:] + f.normal[:]))
    print("\n")

