how do you write a code that calls the newline() funtion?

Recommended Answers

All 5 Replies

How do YOU think you use the newline() function?

More importantly, what newline() function? Python doesn't have one, AFAIK. To print a newline, you use print() with no arguments.

Python does have os.linesep which is perhaps what the OP was referring to. In Python, "\n" will be converted to the proper end of record termination for the OS used.

In Python3 you can specify the end of the print funtion:
print("hello", end='\n') # end='\n' is the default

Similar to C++
cout << "hello" << endl;

In Python3 to get just a new line you have to use

print("")

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.