Issue with my code
marduk at python.net
Tue Feb 5 19:56:55 CET 2013
On Tue, Feb 5, 2013, at 01:38 PM, maiden129 wrote:
> I'm trying to create this program that counts the occurrences of each
> digit in a string which the user have to enter.
> Here is my code:
> s=input("Enter a string, eg(4856w23874): ")
> for i in s:
> if i in checkS:
> if t>1:
> for k in range(1,t):
> print(i, "occurs", t,"times.")
> elif t==1:
> print(i,"occurs 1 time.")
> else: pass
> but it keeps showing this error:
> AttributeError: 'NoneType' object has no attribute 'count'
s=s.remove(i) does not return a new list but modifies the list in
So you probably just want
Also, there are various inefficiencies in your code, but that is the
main issue with the AttributeError.
More information about the Python-list