Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Python - Unicode

The execution of a simple script is not going as thought.

notAllowed = {"â":"a", "à":"a", "é":"e", "è":"e", "ê":"e",
 "î":"i", "ô":"o", "ç":"c", "û":"u"}
word = "dôzerté"
print word
for char in word:
 if char in notAllowed.keys():
 print "hooray"
 word = word.replace(char, notAllowed[char])
print word
print "finished"

The output return the word unchanged, even though it should have changed "ô" and "é" to o and e, thus returning dozerte...

Any ideas?

Answer*

Draft saved
Draft discarded
Cancel

lang-py

AltStyle によって変換されたページ (->オリジナル) /