Python error "AttributeError: 'str' object has no attribute 'casefold'"

0 votes

I'm trying to use the casefold() function in python and I end up with the following error:

 if s1.casefold() == s2.casefold():
AttributeError: 'str' object has no attribute 'casefold'

code snippet:

s1 = 'Tatatata'
s2 = 'tatatata'
if s1.casefold() == s2.casefold():
    print ("equal")
Jul 4, 2019 in Python by Ashish
2,505 views

1 answer to this question.

0 votes
Check your python version. Casefold is possible on version 3.3 and above. Upgrade your python and try again.
answered Jul 4, 2019 by Yesha

Related Questions In Python

0 votes
1 answer

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

There is no attribute called “rows”. The ...READ MORE

answered Mar 28, 2019 in Python by Shri
28,448 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'onkeypress'"

Instead of  wn.onkeypress(go_up, "w") Try wn.onkey(go_uo, " ...READ MORE

answered Jul 4, 2019 in Python by Pooja
956 views
0 votes
1 answer

Python error "'str' object has no attribute 'turtle' in Python turtle"

There is a syntax error. Change the ...READ MORE

answered Jul 8, 2019 in Python by Pallavi
3,199 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 956 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'mainloop'" python module turtle

Hey @Nagya, replace  wn.mainlopp() with turtle.mainloop() ...READ MORE

answered Jun 19, 2019 in Python by Faiza
975 views
+1 vote
1 answer

Python error "AttributeError: 'Turtle' object has no attribute 'Shape'"

Hey @Nagya, replace python.Shape("Square") with the following: python.shape("square") Python is case ...READ MORE

answered Jun 19, 2019 in Python by Faiza
5,547 views