类问题,NoneType obj没有属性 [英] class problem, NoneType obj has no attribute

查看:64
本文介绍了类问题,NoneType obj没有属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.movi​​es =电影


def getID():

返回self.ID


def getMovies():

返回self.movi​​es

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()

推荐答案

globalrev schrieb:
globalrev schrieb:

cust1 = customer .__ init __(''''',''''','''435'',''2332'')
cust1 = customer.__init__(''12'',[''1'',''435'',''2332''])



cust1 =顾客(''12'',''''','''435'',''2332'')


Christian

cust1 = customer(''12'',[''1'',''435'',''2332''])

Christian


Christian Heimes写道:
Christian Heimes wrote:

globalrev schrieb:
globalrev schrieb:

> ; cust1 = customer .__ init __(''''',''''','''435'',''2332'')
>cust1 = customer.__init__(''12'',[''1'',''435'',''2332''])



cust1 = customer('''12'',''''','''435'',''2332'']


cust1 = customer(''12'',[''1'',''435'',''2332''])



....和在此之前


来自客户导入客户


彼得

.... and before that

from custumer import customer

Peter


Christian Heimes写道:
Christian Heimes wrote:

globalrev schrieb:
globalrev schrieb:

> cust1 = customer .__ init __(''12'',[ ''1',''435'',''2332''])
>cust1 = customer.__init__(''12'',[''1'',''435'',''2332''])



cust1 = customer(''''',''''' , '' 435 '', '' 2332 ''])


cust1 = customer(''12'',[''1'',''435'',''2332''])



....之前

来自客户进口客户的



彼得

.... and before that

from customer import customer

Peter


这篇关于类问题,NoneType obj没有属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆