I'm programming in Python and "\n" doesn't work, what do?
What do you mean? Which python? Try it as a char i guess
print ('\n')
>>52507921
>Programming in Python
>Having issues
You get the fuck off here and get on google.
What do you mean it doesn't work??
>>52508012
It just prints "\n" as a string, also it's version 2.7.11.
>>52507964
>not programming solely in BASIC
he should just kill himself already
>>52508045
You're supposed to use the ' charachter to surround \n, not ".
>Having the fucking issue when you can't tell the difference between a charachter and a string.
>>52508073
I'm already using single apostrophes
>>52508069
I have bad news for you...
>>52508045
OP here, I should have mentioned I use a mac
I know i'm retarded but somehow niggers don't steal it (this is laptop nr 5)
Using a mac has nothing to do with this. Install a newer version of python like a logical fucking being, especially since it looks like you don't have to deal with version compatibility considering you can't even understand the new line character.
In python 3, you would type print("\n") to form a new line. This works. the backslash \ indicates an escape sequence where a special character follows (in this case the new line character 'n').
In python 2, I believe you would have to type print "hello world\n" with no parentheses.
You don't need single apostrophes or any of that shit. Just make sure to stay consistent. You can type print('hello world') and it will work. Python automatically interprets all variables as strings. If you use a single apostrophe before, don't use quotes later.
Also upload your full code next time.
>>52508086
Use double quote. Single quote is for string literals.
>>52509599
Wait wait what ? I was under the impression that a single and double quotes were both exactly the same in python
Why do you even need to print a newline?
>>52509643
They are. He's full of shit.
The only real reason to use one over the other is if you want a string with quotes in it and you don't want to use an escape or raw literal.
That, and preference.
Wouldn't he have to escape the escape character to get just /n
>>52510025
OP didn't even state what his problem was
>>52509542
>>52508108
Almost:
1- Both python 2 and 3 support print("shit")
2- It does matter, because osx uses different line endix, so if you move a textfile to your mac you may run unto compatibility shit.
This though, should be in /sqt/ and have code so I'm not going to explain how you can fix it
>>52509862
Good, I figured. Single quotes or die
>>52507945
>as a char
you do realise ' and " characters both start a string, not a character, right? probably a Python 3 thing you're doing though
try \r\n
>>52507921
Python doesn't have a char data type. It's just a string of size 1
>>52507921
You should always use os.linesep instead of /n. Unix line endings are /n and Windows is /r/n
>>52511287
The difference is that ' makes a char and " makes a string, Python treats both of them the same way because it is dynamically typed but they are different
>>52512063
just because it's that way in C doesn't mean it's the same everywhere else>>>type('a')
<class 'str'> #or <type 'str'> on 2.7
>>52512163
C has static typing, it has to tell the difference
>>52512245
doesn't change the fact that ' in python makes strings
>>52511564
As if windows users read output in terminal ever
>>52508069
>Not flipping bits manually