Q:

Getting error while generating the unique id using Python

I am getting some error while generating the unique id using uuid in Python. I am explaining those error below.

Error:

Exception Type:     TypeError
Exception Value:    

coercing to Unicode: need string or buffer, UUID found

I am explaining my code below.
import uuid
filename='+uuid.uuid4()+'.csv'

Here I need to put the file name as some unique id but getting the above error. Please help me to resolve this error.

A:

How about this?
import uuid

filename = str(uuuid.uuid4()) + ".csv"

EDIT:
To avoid using string concatenation:
import uuid

filename = "%s.csv" % str(uuid.uuid4())

