New question #201882 on Sikuli:
https://answers.launchpad.net/sikuli/+question/201882

I've made a script, which read some names in to variables.
These names are compared with some names I read in to another variable.

My problem is that some of those names are scandinavian, that means there are 
special characters in them like: æ, ø and å.
And that means even if i do an:

if nameA == nameB
    print("Match")

It won't match, (Don't know if it's an unicode issue or if you can declare the 
var something else to avoid this..) so I'm looking into replacing the specials 
chars, so that Å = AA, Ø = OE and Æ =AE.


I've looked at http://docs.python.org/library/string.html
And found this: string.replace(str, old, new[, maxreplace])
"Return a copy of string str with all occurrences of substring old replaced by 
new. If the optional argument maxreplace is given, the first maxreplace 
occurrences are replaced."


And thought it worked something like this:

nameA = "Jørgen Ålesen"

copyOfnameA.replace(nameA, ø, oe)
copyOfnameA2.replace(copyOfnameA, Å, Aa)
print (copyOfnameA2)

and the expected output would be:  "Joergen Aalesen"

Would anyone know the correct syntax for this to work? Or perhaps if it's 
possible to make a workaround, like declaring the var something that supports 
scandinavian characters.

Also while on the subject, I have a string with a lot of whitespaces in between 
the text, I'd like to strip the whitespaces (save one to seperate the words) so 
that for example:
"Somethingsomething      Something else              texttext" 
became:
"Somethingsomething Something else texttext"

Is there a command like .strip that can do that?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to