I'm looking to return a multi-line string as part of a REST Get request.
I have the following list:
items = [1,2,3,4,5]
I want to convert it into a string with the line breaks in between. So i did this:
items = "\n".join(items)
Here is the code block I have:
from flask import Flask, jsonify, request, Response, make_response
app = Flask(__name__)
@app.route('/test', methods=['GET'])
def test():
items = [1,2,3,4,5]
items = "\n".join(items)
return items
The response that I get is:
1 2 3 4 5
However, I'm expecting:
1
2
3
4
5
What can I do to fix this?