我写
# -*- coding: utf-8 -*-
def ANdata(key, id, format, nR, start) :
queryUrl = 'http://developer.website.com/api/v4/type/news?api_key=' + key + '&id=' + id + '&format=' + format + '&results=' + nR + '&start=' + start
print "test"
Run Code Online (Sandbox Code Playgroud)
错误是:
Encountered "\"test\"" at line 6, column 11. Was expecting one of: <NEWLINE> ... "(" ... "[" ... ";" ... "," ... "." ... "+" ... "-" ... "*" ... "/" ... "//" ... "<<" ...
">>" ... "%" ... "^" ... "|" ... "&" ... "=" ... ">" ... "<" ... "==" ... "<=" ... ">=" ... "!=" ... "+=" ... "-=" ... "*=" ... "/=" ... "//=" ... "%=" ... "&=" ...
"|=" ... "^=" ... "<<=" ... ">>=" ... "**=" ... "or" ... "and" ... "not" ... "is" ... "in" ... "if" ... ";" ... "," ...
Run Code Online (Sandbox Code Playgroud)
你看到了问题吗?
在Python 3中,print从关键字更改为函数.所以要使用它,你必须把它的参数放在括号中:
print("test")
Run Code Online (Sandbox Code Playgroud)
在Python 2.x中,它可以使用或不使用括号.
| 归档时间: |
|
| 查看次数: |
4365 次 |
| 最近记录: |