# Terminal is printing new line as un-ecaped sequence



## Fahim Ferdous (Feb 14, 2018)

Hi there, I am new to BSD .

Whenever I try running python or any other scripts from the internet (outside ports), my terminal/console would not recognize the new line escape sequence. It would just print it as a backslash and an N. for example, if I print the version info of the interpreter from python, it would print:

```
>>>sys.version
'3.6.4 (default, Feb 11 2018, 17:20:59) \n[GCC 4.2.1 Compatible FreeBSD Clang 4.0.0 (tags/RELEASE_400/final 297347)]'
```
So you can see that there was meant to be a new line on the output but it printed 
	
	



```
\n
```
. I tried running a script a while ago and it did the same thing. I tried setting the locale but didn't work. But when I used bash from shells/linux-c7-bash, it (the script) printed everything  properly. Is there any way to fix this problem? Thanks in advance.


----------



## tobik@ (Feb 14, 2018)

This is normal. sys.version is a string and the Python REPL just shows it to you encoded as a Python string literal. Try

```
print(sys.version)
```


----------



## Fahim Ferdous (Feb 15, 2018)

Thanks, it solves the problem. But is there any way to do it without the print function?


----------



## ralphbsz (Feb 15, 2018)

I don't understand.  You have something in a variable.  In your case it happens to be a string (with some control characters like newline), in other cases it might be an integer, a float, or a more complex thing (a container like a list, or an object).  You want to display the variable in the output stream, in a human-readable format.  For strings, one thing about "human-readable" is that newline characters are turned into actual newlines.  For objects, it might for example mean calling the str() function (or the equivalent __str__ function) to turn them into readable output.  That is exactly the purpose of the print function.  Why don't you want to call the print function?  Doing this "without" the print function is actually quite counter-intuitive.


----------

