title: Swapping two characters in a 2D array in python?
body: <p>So, I'm brand new to programming, and this is frustrating me! What I want to do is be able to import a 4x8 text file, and turn the text into a 2D list so that I can swap two characters. For example, if the imported text file looks like this:</p>
  
  <pre><code>OOOOOOOO
  OOOXOOOO
  OOOOOOOO
  OOOOOOOO
  </code></pre>
  
  <p>then I would like to be able to change the position of the X (the row/column location) when user input is entered, such that an O will get put in its place to preserve formatting. So, for exapmle, the program will prompt the user for their input and if the user enters "up," then the X will move one space up.</p>
  
  <pre><code>OOOXOOOO
  OOOOOOOO
  OOOOOOOO
  OOOOOOOO
  </code></pre>
  
  <p>I want it to repeatedly prompt for a new move after each time one is made, and display the new grid each time (so you can see the X in its new position each time you enter a movement).</p>
  
  <p>This is all I have so far. I know I need to first find the X, but I really don't know how to. I'm stuck here. Any help is appreciated.</p>
  
  <pre><code>#Global variables for the movements
  UP = 8
  DOWN = 2
  RIGHT = 6
  LEFT = 4
  
  #Dimensions of grid
  ROWS = 4
  COLUMNS = 8
  
  def start():        
      filename = input("Enter the name of the Start Positions file: ")
      textFile = open(filename)
      aMaze = [line.strip() for line in textFile]
      for r in range(ROWS):
          for c in range(COLUMNS):
              print(aMaze[r][c], end="")
          print()
  
  def moveType():
      while (True):
          try:
              move = input("ENTER YOUR MOVE: ") 
          except ValueError:
              print("unimportant error message")
              continue
          if ((int(move)) in (DOWN, LEFT, RIGHT, UP)):
              playerMove(move)
              continue
          else:
              print("unimportant error message")
              continue            
      return(move)
  
  def playerMove(move):
      move = (int(move))
      if (move == DOWN):
          #need help here
      elif (move == UP):
          #and here
      elif (move == LEFT):
          #don't know what i'm doing
      elif (move == RIGHT):
          #also here
  
  start()
  moveType()
  </code></pre>