Created
June 14, 2016 15:05
-
-
Save Lothiraldan/218f0b84040e3bc0f8f1243884d838c6 to your computer and use it in GitHub Desktop.
Str encode in a thread
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import threading | |
def to_latin_1(event, value): | |
print(time.time(), "Before encode") | |
value.encode('latin-1', 'ignore') | |
print(time.time(), "After encode") | |
event.set() | |
print(time.time(), "Event set") | |
event = threading.Event() | |
thread = threading.Thread(target=to_latin_1, args=(event, u'42')) | |
thread.start() | |
event.wait(10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import str_encode_thread |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment