Multiple newline escape characters

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

On 30/10/2010 at 16:59, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   12 
Platform:      Mac OSX  ; 
Language(s) :   C.O.F.F.E.E  ;

---------
With the line of code:

println("This is the first line\n\n\nAnd this should be three lines down");

I should get the following output:

**This is the first line

And this should be three lines down**

However I get this:

This is the first line
And this should be three lines down

Why aren't the multiple newline escape characters creating multiple newlines?

Rui Batista

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

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

Try adding "\r\n" for each newline, or try adding an empty space " \n \n" before each newline.

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?

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.

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 😞

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");

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");

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

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?

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".

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

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