<human>:  What is a good Python function to replace new line in string.
<bot>: Here is a Python function to replace new line in string

import string

def replace_newline(string):
  """Replace new line in string."""
  return string.replace("\n", " ")

# Enter the string
string = "hello\nworld"

# Calling the function
print((replace_newline(string)))

#Example Output
# hello world

#Remember to inspect code for bugs.