How does python elegantly append data to an item in an indefinite format dict as an array?

ret = dict()
for symbol in symbols:
    if symbol.basic.name not in ret:
        ret[symbol.basic.name] = [symbol.to_json()]
    else:
        ret[symbol.basic.name].append(symbol.to_json())

this feels so troublesome. Is there any more elegant way to deal with it?

Aug.20,2021

ret.setdefault(symbol.basic.name, []).append(symbol.to_json())
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c558-2c2fb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c558-2c2fb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?