【发布时间】:2015-01-06 14:30:20
【问题描述】:
谁能告诉我以下哪个字符是非 ASCII 字符:
Columns(str) – 逗号分隔的值列表。仅当格式为制表符或 xls 时才有效。对于 UnitprotKB,一些可能的列是:id、条目名称、长度、有机体。某些列名必须后跟数据库名称(即“数据库(PDB)”)。再次查看 unipro 网站了解更多详情。有关 column 关键字的完整列表,另请参见 _valid_columns。
本质上我是在定义一个类并试图给它一个注释来定义它是如何工作的:
def test(self,uniprot_id):
'''
Same as the UniProt.search() method arguments:
search(query, frmt='tab', columns=None, include=False, sort='score', compress=False, limit=None, offset=None, maxTrials=10)
query (str) -- query must be a valid uniprot query. See http://www.uniprot.org/help/text-search, http://www.uniprot.org/help/query-fields See also example below
frmt (str) -- a valid format amongst html, tab, xls, asta, gff, txt, xml, rdf, list, rss. If tab or xls, you can also provide the columns argument. (default is tab)
include (bool) -- include isoform sequences when the frmt parameter is fasta. Include description when frmt is rdf.
sort (str) -- by score by default. Set to None to bypass this behaviour
compress (bool) -- gzip the results
limit (int) -- Maximum number of results to retrieve.
offset (int) -- Offset of the first result, typically used together with the limit parameter.
maxTrials (int) -- this request is unstable, so we may want to try several time.
Columns(str) -- comma-seperated list of values. Works only if format is tab or xls. For UnitprotKB, some possible columns are: id, entry name, length, organism. Some column names must be followed by a database name (i.e. ‘database(PDB)’). Again see uniprot website for more details. See also _valid_columns for the full list of column keyword. '
'''
u = UniProt()
uniprot_entry = u.search(uniprot_id)
return uniprot_entry
如果没有第 52 行,即在引用的注释块中以“列”开头的行,这可以按预期工作,但是一旦我描述了“列”是什么,我就会收到以下错误:
SyntaxError: Non-ASCII character '\xe2' in file /home/cw00137/Documents/Python/Identify_gene.py on line 52, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
有人知道发生了什么吗?
【问题讨论】:
-
您是否尝试阅读错误信息?
-
是的,正如我上面所说,第 52 行是引用的注释块中以“列”开头的行。删除整行会导致代码正常
标签: python unicode syntax syntax-error quoting