[英]What is positional argument follows keyword argument?
我收到以下错误:
File "ex01", line 15
download(urlbase=dna[0], str) and \
^
SyntaxError: positional argument follows keyword argument
这是我的代码
class Gene(object):
def __init__(self, dna, exon_regions):
"""
dna: string or (urlbase, filename) tuple
exon_regions: None, list of (start, end) tuples or (urlbase, filename) tuple
In case of (urlbase, filename) tuple the file is downloaded and read.
"""
if isinstance(dna, (list, tuple)) and \
len(dna) == 2 and isinstance(dna[0], str) and \
isinstance(dna[1], str):
download(urlbase=dna[0], str) and \
dna = read_dnafile(dna[1])
elif isinstance(dna, str):
pass
else:
raise TypeError(
'dna=%s is not string or (urlbase, filename) '\
'tuple' %(dna, type(dna)))
self._dna = dna
您能解释一下代码出了什么问题吗?
我收到以下错误:
File "ex01", line 15
download(urlbase=dna[0], str) and \
^
SyntaxError: positional argument follows keyword argument
这是我的代码
class Gene(object):
def __init__(self, dna, exon_regions):
"""
dna: string or (urlbase, filename) tuple
exon_regions: None, list of (start, end) tuples or (urlbase, filename) tuple
In case of (urlbase, filename) tuple the file is downloaded and read.
"""
if isinstance(dna, (list, tuple)) and \
len(dna) == 2 and isinstance(dna[0], str) and \
isinstance(dna[1], str):
download(urlbase=dna[0], str) and \
dna = read_dnafile(dna[1])
elif isinstance(dna, str):
pass
else:
raise TypeError(
'dna=%s is not string or (urlbase, filename) '\
'tuple' %(dna, type(dna)))
self._dna = dna
您能解释一下代码出了什么问题吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.