Python Forum
If statement containing apostrophe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If statement containing apostrophe
#11
(Jul-09-2019, 09:09 AM)AshBax Wrote:
Output:
['I don’t know'] I don't know WRONG! i want to see : I don’t know
maybe it´s because the two apostrophes are not the same?
’ != '
Reply
#12
I have been able to create a work around by using the "re" package:
from line 29 onwards:
for i in range(0,len(gameplay_A)):
    answer = input(gameplay_A[i] + "\n")
    new_answer = re.sub("[^a-zA-Z]+", "", answer)
    new_gameplay = re.sub("[^a-zA-Z]+", "", gameplay_B[i])
    if answer.lower() == gameplay_B[i].lower() or new_answer.lower() == new_gameplay.lower():
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CSV not printing apostrophe correctly bazcurtis 8 2,439 Aug-22-2022, 04:28 PM
Last Post: bazcurtis
  Is it possible to have an apostrophe inside { } in an f-string? Exsul 6 9,567 Sep-05-2019, 12:37 AM
Last Post: Exsul

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020