小编dot*_*ash的帖子

为什么非默认参数不能遵循默认参数?

为什么这段代码会抛出一个SyntaxError?

  >>> def fun1(a="who is you", b="True", x, y):
...     print a,b,x,y
... 
  File "<stdin>", line 1
SyntaxError: non-default argument follows default argument
Run Code Online (Sandbox Code Playgroud)

虽然下面的代码运行没有可见的错误:

>>> def fun1(x, y, a="who is you", b="True"):
...     print a,b,x,y
... 
Run Code Online (Sandbox Code Playgroud)

python

118
推荐指数
3
解决办法
13万
查看次数

使用Tango和Django开始使用django

与Django一起开发django 的资源Tango有多好?鉴于我已完成从官方django网站编写您的第一个django应用程序教程的基础知识?

python django

4
推荐指数
1
解决办法
1196
查看次数

在python中将str转换为dict

我使用subprocess.Popen()从进程的输出中得到了这个:

    { about: 'RRDtool xport JSON output',
  meta: {
    start: 1401778440,
    step: 60,
    end: 1401778440,
    legend: [
      'rta_MIN',
      'rta_MAX',
      'rta_AVERAGE'
          ]
     },
  data: [
    [ null, null, null ],
    [ null, null, null ],
    [ null, null, null ],
    [ null, null, null ],
    [ null, null, null ],
    [ null, null, null  ]
  ]
}
Run Code Online (Sandbox Code Playgroud)

它对我来说似乎不是一个有效的json.我已经使用ast.literal_eval()json.loads(),但没有运气.有人可以帮我正确的方向吗?提前致谢.

python json dictionary rrdtool

3
推荐指数
1
解决办法
651
查看次数

标签 统计

python ×3

dictionary ×1

django ×1

json ×1

rrdtool ×1