go defer
go defer 命名和匿名返回值函数中的返回结果不同
1 | // @param value 微秒 |
settings.py
1 | DATABASES = { |
如果报错
ImproperlyConfigured: mysqlclient 1.3.13 or newer is required
pip install mysqlclient
matplotlib 图片存储 ImageField
1 | from django.core.files.images import ImageFile |
pip install pipreqs
pipreqs . –encoding=utf8 –force
注意 –encoding=utf8 为使用utf8编码,不然可能会报UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xae in position 406: illegal multibyte sequence 的错误。
–force 强制执行,当 生成目录下的requirements.txt存在时覆盖。
1 | type Test struct { |
String values encode as JSON strings coerced to valid UTF-8,
replacing invalid bytes with the Unicode replacement rune.
The angle brackets “<” and “>” are escaped to “\u003c” and “\u003e”
to keep some browsers from misinterpreting JSON output as HTML.
Ampersand “&” is also escaped to “\u0026” for the same reason.
This escaping can be disabled using an Encoder that had SetEscapeHTML(false) alled on it.
json.Marshal 默认 escapeHtml 为 true,会转义 <、>、&
1 | func Marshal(v interface{}) ([]byte, error) { |
1 | content = strings.Replace(content, "\\u003c", "<", -1) |
1 | type Test struct { |
1 | func JSONMarshal(t interface{}) ([]byte, error) { |