0

I keep getting the error that str object is not callable. my line of code is pasted below... can anyone tell me what I am doing wrong.

random = str(uuid.uuid4().hex().upper()[0:6])

1
  • if you have such kind of problems it's best to decompose the line in question and you will normally find the error. or have a clearer understanding. example line1: v = uuid.uuid4() line 2: v = v.hex() line 3: v = v.upper() line 4: v = v[0:6]` ; line 5 : random = str(v) What's also important is to show us the import line, that you were using for uuid. Commented Oct 8, 2019 at 18:06

1 Answer 1

1

change hex() to hex. .hex is a property, not a function, and it already returns a string.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.