How do I split an input String into seperate usable integers in python
<p>I'm trying to split a Input String xyz into 3 tokens and then seperating into 3 integers called x, y, and z.
I want it to do this so that I have to do less input and then be able to use them for the coordinates of <code>mc.setblocks(x1, y1, z1, x, y, z, BlockId)</code>.     How do I Separate it so that it turns out as 3 different ints and\or split them into tokens to do so? I know how I would do this in java but I have no clue of how to do it in python. It should look something like this :</p>

<pre><code>xyz1 = input("enter first coordinates example: 102 36 74")
st = StringTokenizer(xyz1)
x = st.nextToken
y = st.nextToken
z = st.nextToken
</code></pre>

<p>You can use the <code>split()</code> method of the <code>string</code> object, which defaults to splitting on whitespace characters.  This will give you a list of separate strings.  To convert each string to an <code>integer</code>, you could use a comprehension.  Assuming the input is in correct form, the following one-liner will do it:</p>

<pre><code>x, y, z = ( int(coord) for coord in xyz1.split() )
</code></pre>

python split coordinates tokenize minecraft