求问Ubuntu下eclipse+pydev环境提示有错,ubuntupydev,程序源码如下:#codi
求问Ubuntu下eclipse+pydev环境提示有错,ubuntupydev,程序源码如下:#codi
程序源码如下:
#coding =utf-8def vowels_count(string): ret = 0 for c in string: if c in "dskfhkfh": ret +=1 return rets = "kjfhkjlf"print vowels_count(s) print range(len("hello world"))
在ubuntu下的eclipse+pydev环境下,会在第10行,即
print vowels_count(s)
处提示有错。错误信息为(这个错误信息是显示在行号前):
Encountered "vowels_count" at line 10, column 7. Was expecting one of: <NEWLINE> ... "(" ... "[" ... ";" ... "," ... "." ... "+" ... "-" ... "*" ... "/" ... "//" ... "<<" ... ">>" ... "%" ... "^" ... "|" ... "&" ... "=" ... ">" ... "<" ... "==" ... "<=" ... ">=" ... "!=" ... "+=" ... "-=" ... "*=" ... "/=" ... "//=" ... "%=" ... "&=" ... "|=" ... "^=" ... "<<=" ... ">>=" ... "**=" ... "or" ... "and" ... "not" ... "is" ... "in" ... "if" ... ";" ... "," ...
但是run还会有正确结果
output:5[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
既然能够正常运行,那么这只是 IDE 的 bug 而已(Python 是动态语言,因此 IDE 的静态分析很难完全做对)。如果你嫌烦,可以不用功能过于强大的 IDE,或者关掉这种提示。
又看了一下,也有可能是强制代码风格的信息(也就是代码风格问题)。
编橙之家文章,
相关内容
- Python列表转换怎么写比较高效,python列表怎么写,a = [
- 请问python什么方法可以找到当前目录下的指定文件?,
- Python写文件时换行没执行哪里出问题,python写换行执行
- python批量抓取二级域名标题的方法,python二级域名,#
- Linux实现Python读取word文件方法是?,linuxpython,R.T.doc 是
- Python os.environ能获取到的环境变量,在os.environ.getenv得不
- Python lxml xpath解析为何只能获得头部信息,lxmlxpath,我在
- Python http requests模拟登录与提交表单的实现问题,pyth
- Python IDE代码复制到word中,缩进问题如何保证,pythonide
- 不是很理解这段python for循环的原理,pythonfor循环原理
评论关闭