python - Initialize different variables with different value in a single statement -


I have Python variable as shown below. I want to start all these variables with different values ​​in the same statement in the global A, B, C

.

Is this possible?

  a = b = c = Uuid.uuid1 () // to A, B and C   

call uuid.uuid1 () three times:

  a, b, c = Uuid.uuid1 (), uuid.uuid1 (), uuid.uuid1 ()   

You can make it a loop, but for 3 fixed items Why bother? In addition, for such an unexpected assignment with only 2 or 3 elements with a CPithon compiler

If you use a loop in any way (if you have some additional goals), then use the generator expression and avoid creating a list object: for xrange (8)

  a, b, c, d, e, f, g, h = (uuid.uuid1 ())    

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -