git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]# String slices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Paul St George wrote: > In the code (below) I want a new line like this: > > Plane rotation X: 0.0 > Plane rotation Y: 0.0 > Plane rotation Z: 0.0 > > But not like this: > > Plane rotation X: > 0.0 > Plane rotation Y: > 0.0 > Plane rotation Z: > 0.0 > > Is it possible? > print( > > "Plane rotation X:",bpy.data.objects["Plane"].rotation_euler[0], > > "Plane rotation Y:",bpy.data.objects["Plane"].rotation_euler[1], > > "Plane rotation Z:",bpy.data.objects["Plane"].rotation_euler[2], > > file=outstream, sep="\n" > > ) Explanation: The newlines between all positional args of print() are caused by the sep="\n" keyword argument. You probably got the idea from my x, y, z = bpy.data.objects["Plane"].rotation_euler print( "Plane rotation X:", x, "Plane rotation Y:", y, "Plane rotation Z:", z, file=outstream, sep="\n" ) in the other thread where I introduced the bug when trying to simplify my original suggestion (which I didn't post) print( f"Plane rotation X: {x}", f"Plane rotation Y: {y}", f"Plane rotation Z: {z}", file=outstream, sep="\n" ) But as Dan says, use separate print() calls.

- Prev by Date:
**String slices** - Next by Date:
**py2 to 3 base64 issues** - Previous by thread:
**String slices** - Next by thread:
**String slices** - Index(es):