我正在使用此代码将用户序列化为json文本文件.
if (File.Exists(path))
{
using (var file = File.CreateText(path))
{
var serializer = new JsonSerializer();
serializer.Serialize(file, this.users);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的结果:
[![输出]](https://i.stack.imgur.com/625cR.png)
我怎样才能得到这样的结果:
[![漂亮地打印]](https://i.stack.imgur.com/NPmtX.png)
这是我的代码的一部分:
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
Run Code Online (Sandbox Code Playgroud)
如果信用证过期,则必须刷新。在 Windows 上这部分工作,但在 Linux 上我得到一个错误(在最后一个字符串上):
('invalid_scope: Some requested scopes were invalid. {invalid=[a, c, d, e, g, h, i, l, m, ., /, o, p, r, s, t, u, v, w, :]}', '{\n "error": "invalid_scope",\n "error_description": "Some requested scopes were invalid. {invalid\\u003d[a, c, d, e, g, h, i, l, m, ., /, o, p, r, s, t, …Run Code Online (Sandbox Code Playgroud)