1
What would be the string equivalent :
values = """
{
"exchange_code": "PLNX",
"exchange_market": "BTC/USDT"
}
"""
Which the result is :
'\n { n "exchange_code": "PLNX", n "exchange_market": "BTC/USDT" n } n'
entering "PLNX" and "BTC/USDT" as variables, I’m trying some variations like the below but I can’t replicate the above result :
def equi_string(exchange,market):
values = """
{
"exchange_code": """+exchange+""",
"exchange_market": """+market+"""
}
"""
return values
'\n { n "exchange_code": PLNX, n "exchange_market": BTC/USDT n } n '
This for example is missing "" in PLNX and BTC/USDT
How do I make the string return exactly the first example ?
Try using json. https://docs.python.org/3/library/json.html. Probably a string in json format
– Miguel