Browse Source

add python

master
Markus Bergholz 1 year ago
parent
commit
c5f215434d
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      til.md

+ 14
- 0
til.md View File

@@ -317,3 +317,17 @@ aws_secret_access_key = ...
and do

./goofys --endpoint ams3.digitaloceanspaces.com melmac /home/ec2-user/t/

# python

Python json dump with datetime. every time `JSON` doesn't know how to convert a value, it calls
the `default()` function.

```
def dtconverter(o):
if isinstance(o, datetime.datetime):
return o.__str__()

print(json.dumps(my_py_dict_var, default = dtconverter))

```

Loading…
Cancel
Save