问题描述
wassup在这里?
wassup here?
$
Traceback(最近一次电话会议):
文件C:\Python25 \ myPrograms \ netflix \ netflix.py,第22行,
< module>
print cust1 .getID()
AttributeError:''NoneType''对象没有属性''getID''
7
Traceback (most recent call last):
File "C:\Python25\myPrograms\netflix\netflix.py", line 22, in
<module>
print cust1.getID()
AttributeError: ''NoneType'' object has no attribute ''getID''
班级客户:
def __init __(自我,身份证,电影):
self.ID = ID
self.movies =电影
def getID():
返回self.ID
def getMovies():
返回self.movies
import os
进口客户
导入电影
mv1 = open(''C:\\Python25 \\myPrograms \\\\
etflix \ \ mv1exp2.t xt'',''r +'')
mv1str = mv1.read()
print mv1str.count('', 5,'')
cust1 = customer .__ init __('''12'',[''''','''435'',''2332'')
print cust1.getID()
class customer:
def __init__(self, ID, movies):
self.ID = ID
self.movies = movies
def getID():
return self.ID
def getMovies():
return self.movies
import os
import customer
import movie
mv1 = open(''C:\\Python25\\myPrograms\\netflix\\mv1exp2.t xt'', ''r+'')
mv1str = mv1.read()
print mv1str.count('',5,'')
cust1 = customer.__init__(''12'',[''1'',''435'',''2332''])
print cust1.getID()
推荐答案
cust1 =顾客(''12'',''''','''435'',''2332'')
Christian
cust1 = customer(''12'',[''1'',''435'',''2332''])
Christian
cust1 = customer('''12'',''''','''435'',''2332'']
cust1 = customer(''12'',[''1'',''435'',''2332''])
....和在此之前
来自客户导入客户
彼得
.... and before that
from custumer import customer
Peter
cust1 = customer(''''',''''' , '' 435 '', '' 2332 ''])
cust1 = customer(''12'',[''1'',''435'',''2332''])
....之前
来自客户进口客户的
彼得
.... and before that
from customer import customer
Peter
这篇关于类问题,NoneType obj没有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!