您好,我以学习python的艰难方式为例,并努力理解python。我已经在书中发现一个错误,意识到您需要()打印字符串。因此,也许在语法上可能会有更多错误。当我运行该文件时,我收到一条错误消息
ValueError:没有足够的值来打包(预期为2,得到1)语法错误。还有另一个一般语法错误。所以我不能将提示设置为raw_input。
SELECT
avg(birds)
FROM [FocalAreas].[dbo].[Observation] as o, FocalAreas.dbo.Count as c, FocalAreas.dbo.MonitoringPoint as mp
WHERE EXISTS
(Select
Count(o.ObservationID) as birds
,o.CountID
,mp.MonitoringPointID
FROM [FocalAreas].[dbo].[Observation] as o, FocalAreas.dbo.Count as c, FocalAreas.dbo.MonitoringPoint as mp
where o.CountID = c.CountID
and c.MonitoringPointID = mp.MonitoringPointID
and StateID = 'NE'
and AOUSpeciesID = 1
and Route = 'Focal'
and datepart(year, CountDate) = 2014
group by o.CountID, mp.MonitoringPointID)
答案 0 :(得分:0)
代码示例中是否有错字?是$s
而不是格式字符串中的%s
?
我怀疑您的实际代码中包含以下内容:
print ("Hi %s, I'm the %s script.") % user_name, script
您打算这样写:
print "Hi %s, I'm the %s script." % (user_name, script)
也就是说,打印单个字符串,这是将格式字符串应用于两个参数的结果。