模块KNN.pyPython2.7.8(default,Jun302014,16:08:48)[MSCv.150064bit(AMD64)]onwin32Type"copyright","credits"or"license()"formoreinformation.>>>fromnumpyimport*>>>importoperat...
模块KNN.py
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from numpy import *
>>> import operator
>>> def createdataset():
group = arry([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])
labels = ['A','A','B','B']
return group,labels
导入自定义模块
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import KNN
Traceback (most recent call last):
File "", line 1, in
import KNN
File "KNN.py", line 1
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
^
SyntaxError: invalid syntax
>>> from KNN import*
Traceback (most recent call last):
File "", line 1, in
from KNN import*
File "KNN.py", line 1
Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32
^
SyntaxError: invalid syntax
>>>
导入自带模块
>>> import ast
>>>
请问这是什么情况啊
展开