title: I made this kinda simple code which should read my syntax(which is 'prt(Nice)'), but it throws this: IndexError: string index out of range
body: <p>Code:</p>
  <pre><code>f = open('C:/Users/Sasha/Desktop/file.txt','r')
  fc = f.readline()
  LinesToRead = 2
  StartArg = fc.find('(') + 1
  EndArg = fc.find(')') - 1
  ArgLength = EndArg - (StartArg - 1)
  ReadArgChar = &quot;&quot;
  ReadFuncChar = &quot;&quot;
  Arg = &quot;&quot;
  Func = &quot;&quot;
  FuncStart = 0
  FuncEnd = 3
  x = StartArg
  y = FuncStart
  line = 0
  
  for i in range(LinesToRead):
      # This For loop reads the function's argument:
      for i in range(ArgLength):
          ReadArgChar = fc[x]
          Arg += ReadArgChar
          x += 1
          if x == (EndArg + 1):
              break
  
      # This For loop reads the function:
      for i in range(FuncEnd):
          ReadFuncChar = fc[y]
          Func += ReadFuncChar
          y += 1
          if y == (FuncEnd + 1):
              break
  
      # This if-else statement interprets the function syntax:
      if Func == &quot;prt&quot;:
          print(Arg)
      elif Func == &quot;brk&quot;:
          print(&quot;[Program Finished...]&quot;)
  </code></pre>
  <p>Error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;c:\Users\Sasha\Desktop\PlanetScript.py&quot;, line 20, in &lt;module&gt;
      ReadArgChar = fc[x]
  IndexError: string index out of range'
  </code></pre>