Skip to content
Advertisement

Category: Questions

Regex removes certain words from my string – Python

The below code is to lookup a dictionary and replace string with values corresponding to dict’s key. Can someone help me understand why my code omits certain words? It removes lh preceeded and followed with a . i.e., lh. and .lh. How to overcome this? I get the output left hand l.h. -left hand- l.h plh phli lhp 1lh lh1

Decode UUID 4 as a Python string

I would like to generate a UUID v4 string starting from the uuid import from the Python standard library. I know I can cast a UUID to str by doing str(uuid.uuid4()), however I am trying to understand what the bytes in that class instance mean. While trying to decode those bytes I see all sorts of errors, either the string

Advertisement