Home > Back-end >  How would i split up 2 values in parentheses in Python?
How would i split up 2 values in parentheses in Python?

Time:01-23

So, I'm working on a python script that will auto click at the coordinates of set pixels. I'm encountering an issue where I need to split up two values in normal parentheses. Example:

(1023, 503)

Is there any way to even split this up into two variables or is it impossible?

CodePudding user response:

these values in parenthesis are called tuples, and they can be unpacked,

Example:

>>> value1,value2 = (1,0)
>>> value1
1
>>> value2
0

in your case:

variable1,variable2 = (1023, 503)
  •  Tags:  
  • Related