Skip to content Skip to sidebar Skip to footer

Json Output S --- Just Print The Output Withou U

I am parsing a JSON output asbelow...this is just a snippet..currently it is printing the u'' format...How do i just print 'deleted' error=change['Errors'] print error Output: [u'

Solution 1:

Depends on what you want to do when there's more than one value in change['Errors']. Currently the value is a list of one element (u'DELETED'). If you want to print just the text, you need:

printerror[0]

But maybe just in case it would be better to do:

printu', '.join(error)

Solution 2:

JSON works with unicode by default. If you need another codec, you can pass an encoding argument to the dump function:

json.dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding="utf-8", default=None, sort_keys=False, **kw)

Post a Comment for "Json Output S --- Just Print The Output Withou U"