title: How to run a Python script in Jenkins Pipeline and get the last token?
body: <p>Here is my code for Jenkins Pipeline:</p>
  
  <pre><code>A = bat(script:'c:\\python27\\python.exe D:\\A.py', returnStdout: true).tokenize().last
  </code></pre>
  
  <p>It works really well to run the Python script in Batch and get the last token. But now I also want to display the log of this Python script. So I tried code as below:</p>
  
  <pre><code>A = bat(script:'c:\\python27\\python.exe D:\\A.py', returnStdout: true).tokenize()
  B = A.last
  println A
  </code></pre>
  
  <p>But somehow this Python script will run twice, which is NOT what I want.</p>
  
  <p>Any advice?</p>