I don't know what this means. What do you mean by "printing this out in note pad" and "not working" and "other commands like \t"?
Please be very specific about what exactly you are trying to do, what you expect, and what exactly the results were.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAGhqNnn75f%3DBRq6aQV34fZWE0MCraOxHrXWYxFwjSVqOnXZ%2BjA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3Auaciu%3DppT0JS%3DBShTbMvejtVHsJBrHiQoYJ0OHQcAQ%40mail.gmail.com.
Again, when you say something is not working properly, it isn’t clear what your result is (error, or new second line not printing at all, or second print not printing on a new line). I am just going to assume you mean it didn’t print on its own new line…
“\n” and “\t” are special characters (as opposed to commands). The newline character is platform specific, and on Windows you probably want “\r\n”. Python gives you a platform independent way to do it. Give this a try and see if it fixes your problem?
import os
...
# platform specific line separator command via os.linesep
file.write("i am line 1" + os.linesep)
Also, if you want to clean up your snippet a bit, you could write it like this:
import os
import maya.cmds as cmds
path=cmds.internalVar(upd=True)+"preset.txt"
with open(path, 'w') as f:
f.write("i am line 1" + os.linesep)
f.write("i am line 2")
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAGhqNn%3DcPKmR7a7QzosX3aityqMhYSX%2Bj-vZm3wyVCtv1mVNHA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA24GcR4m1kgVALjRYMOt488E1wr1JnHa%2B9W%3DOO151hffw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAGhqNnkBdp_jbLzY4uO%2BawEiiv7qbVQwERmsih65NwH8kjCFaQ%40mail.gmail.com.