码迷,mamicode.com
首页 > 编程语言 > 详细

Python常见问题处理

时间:2014-12-28 11:32:39      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

1:Unused import 

环境:Ubuntu 14.04  eclipse 3.8

eclipse环境下利用PyDev插件做开发的时候,输入:import re,左边会出现一个黄色的警告,属标放上去后会显示:Unused import re

原因如下:(ref:http://stackoverflow.com/questions/16394732/unused-wild-import-why)

That message just tells you that you are importing features from a module that you don‘t need, which means you should probably import just what you need. You shuld simply use from foobar import x, ywhere x and y are the elements you actually need.The syntax from foobar import * is more useful in the command-line interpreter when you don‘t want to think or type many more characters for little benefit. But in a real project, you should not use that syntax since if you use it, it will not be clear which feature from the module you are going to use.

也就是说:只import re 而没有使用 re,等后面使用到re的方法时候,这个警告自然会消除

 

Python常见问题处理

标签:

原文地址:http://www.cnblogs.com/datacatcher/p/4189694.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!