Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Multiple newline escape characters

    Scheduled Pinned Locked Moved SDK Help
    12 Posts 0 Posters 840 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 30/10/2010 at 17:35, xxxxxxxx wrote:

      None of those methods worked. The first one (\r\n) returns an error and I can't add spaces at the beginning of lines. What I'm trying to do is to create a script that generates Python code. I would like to be able to leave empty lines to separate bits of code. But Python is very strict with space indenting lines.
      Shouldn't the \n\n\n work? Is it a bug?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 30/10/2010 at 19:07, xxxxxxxx wrote:

        As far as I know, \r is a valid escape sequence for Python and other programming languages.
        \r\n = CR+LF
        On a typewriter, LF would move the line down, and CR would move the cursor position back to the left.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 31/10/2010 at 01:16, xxxxxxxx wrote:

          Well, I know that those are supposed to be carriage return + linefeed. But I'm generating the string in COFFEE. When I use that string as a Python script, all the \n are treated as one 😞

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 31/10/2010 at 02:54, xxxxxxxx wrote:

            Why not put a comment marker(#) where you want a blank line? It's not quite whitespace, but it's almost as good.

            println("This is the first line\n#\n#\nAnd this should be three lines down");
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 31/10/2010 at 06:50, xxxxxxxx wrote:

              simply put a space in between them:
              println("This is the first line\n \n \nAnd this should be three lines down");

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 31/10/2010 at 11:45, xxxxxxxx wrote:

                The problem with adding spaces is that Python is very picky with spaces at the beginning of lines. Indentation define code blocks. I guess I will have to use comments.
                But why can't I set multiple newlines without adding a character to each line?

                Rui Batista

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 31/10/2010 at 11:59, xxxxxxxx wrote:

                  Oh I haven´t seen that you want to output python code. haven´t used python yet so I think I cannot be of much help but isn´t python intendation tabbed and not spaced?

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 31/10/2010 at 12:24, xxxxxxxx wrote:

                    Originally posted by xxxxxxxx

                    Well, I know that those are supposed to be carriage return + linefeed. But I'm generating the string in COFFEE. When I use that string as a Python script, all the \n are treated as one 😞

                    Ok, then, how about an invisible tab?
                    " \n"
                     
                    If that doesn't work, then try writing your escape sequences in hex form, "\x0a".

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 31/10/2010 at 15:35, xxxxxxxx wrote:

                      Well, the "\n " works, kind of... however, I read somewhere that Python prefers indentation based on spaces instead of tabs.

                      Rui Batista

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 03/11/2010 at 07:12, xxxxxxxx wrote:

                        println should only be used to print a line into the console. If you want to print several lines you have to call println for each line.

                        cheers,
                        Matthias

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post