Answers.Body: <p>There is <code>Board.san()</code> which gives you the algebraic notation. You can check the docs <a href="https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.san" rel="nofollow noreferrer">here</a>.</p>
  <p>You will need a Board object for it.</p>
  <pre><code>import chess
  
  board = chess.Board()
  move = chess.Move.from_uci(&quot;e2e4&quot;)
  print(board.san(move))
  # Output: e4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-16T07:02:59.183Z
Answers.LastActivityDate: 2021-08-16T07:02:59.183Z
Answers.UserDisplayName: Minot
Body: <p>The following Python code gives the best move in coordinate notation:</p>
  <pre><code>import chess
  import chess.engine
  sfEngineTxt = &quot;E:\Chess\Stockfish\stockfish_14_x64_modern&quot;
  sfEngine = chess.engine.SimpleEngine.popen_uci(sfEngineTxt)
  sfInfo = sfEngine.analyse(chess.Board(), chess.engine.Limit(depth=11), info=chess.engine.INFO_ALL)
  moveArray = sfInfo['pv']
  moveTxt1 = str(moveArray[0])
  print(moveTxt1)
  sfEngine.quit()
  </code></pre>
  <p>This outputs <strong>e2e4</strong>. What I want is <strong>e4</strong>, I.e. algebraic notation or san notation.</p>
  
Tags: <analysis><notation><python>
Title: How do I convert a move from coordinate notation to algebraic notation?
ThreadText: # How do I convert a move from coordinate notation to algebraic notation?
  
  (Asked by: username_0 on 2021-08-15)
  
  The following Python code gives the best move in coordinate notation:
  
  ```
  import chess
  import chess.engine
  sfEngineTxt = "E:\Chess\Stockfish\stockfish_14_x64_modern"
  sfEngine = chess.engine.SimpleEngine.popen_uci(sfEngineTxt)
  sfInfo = sfEngine.analyse(chess.Board(), chess.engine.Limit(depth=11), info=chess.engine.INFO_ALL)
  moveArray = sfInfo['pv']
  moveTxt1 = str(moveArray[0])
  print(moveTxt1)
  sfEngine.quit()
  
  ```
  
  This outputs **e2e4**. What I want is **e4**, I.e. algebraic notation or san notation.
  
  **Tags:** analysis, notation, python
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-08-16. Score: 3 | Accepted answer
  
  There is `Board.san()` which gives you the algebraic notation. You can check the docs [here](https://python-chess.readthedocs.io/en/latest/core.html#chess.Board.san).
  
  You will need a Board object for it.
  
  ```
  import chess
  
  board = chess.Board()
  move = chess.Move.from_uci("e2e4")
  print(board.san(move))
  # Output: e4
  
  ```
  
  
  ---
  
  