exat1as
exat1as

Reputation: 13

How to encode text in Choregraphe NAO

Encoded text I want to read list from file but its getting all coded and .encode doesn't really work

    import json,sys
    with open('your_file.txt') as f:
        lines = f.read().splitlines()

    self.logger.info(lines)
    self.tts.say(lines[1])

Upvotes: 1

Views: 145

Answers (1)

Bora
Bora

Reputation: 1522

If your file is saved with UTF-8 encoding, this should work:

with open('text.txt', encoding = 'utf-8', mode = 'r') as my_file: 

If this doesn't work, your text file's encoding is not UTF-8. Write your file's encoding in place of utf-8. How to determine the encoding of text?

Or if you share your input file as is, I can figure that out for you.

Upvotes: 0

Related Questions