Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove the 'u' before each result? #13

Open
Elliot-Potts opened this issue May 30, 2017 · 2 comments
Open

How to remove the 'u' before each result? #13

Elliot-Potts opened this issue May 30, 2017 · 2 comments

Comments

@Elliot-Potts
Copy link

Hello. Sorry for my ignorance here. I was just wondering how I'd remove the 'u' before each result. I am trying to get the synonym for (Example) word 'Hello', and then use PyTTSX to read it back to them, however I am unsure on how to remove the 'u' at the beginning of each word/synonym.

Any help would be greatly appreciated.
Thanks.

@modelmat
Copy link

@Elliot-Potts The u is for unicode text in python. You can use str.encode("utf-8") to turn it into a normal string.

@b1tninja
Copy link

b1tninja commented Feb 21, 2021

hey @Elliot-Potts, I recently used this library in conjunction with pyttsx3 to read out definitions. Maybe you would find it interesting. https://github.com/b1tninja/misty/blob/main/definitions.py as for the u prefix, I believe that if you switched to python3 you wouldn't "see" the u. The strings in in python2 that were unicode showed with a u prefix when you used print(). perhaps text.decode('utf-8') as @modelmat suggested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants