Python Code Statement / Comment Method
Python Code Statement / Comment Method dict default foreach Code a_dict = { 'color' : 'blue' , 'fruit' : 'apple' , 'pet' : 'dog' } for key in a_dict: print(key) output color fruit pet foreach .items() Code a_dict = { 'color' : 'blue' , 'fruit' : 'apple' , 'pet' : 'dog' } for key in a_dict.items(): print(key) output ( 'color' , 'blue' ) ( 'fruit' , 'apple' ) ( 'pet' , 'dog' ) Code for key, value in a_dict.items(): print(key, '->' , value) Output color -> blue fruit -> apple pet -> dog datatime String(ISO8601) to Datetime lAt: datetime = dateutil.parser.parse( "2019-09-07T-15:50+00" ) datetime to ISO8601 String time=datetime.now() time.isoformat() JSON Json String to dict qobj = json.loads(jstr) dict to JSON String jstr = json.dumps(dictObj) escape unescape url import urllib.par...