title: How to get the first function call argument via AST?
body: <p>I'm trying to get arguments from a function call. For example we have such function call sample:</p>
  <pre><code>self.assertEqual(dictlike.fromkeys('a'), {'a':None})
  </code></pre>
  <p>I use such code:</p>
  <pre><code>import ast
  
  
  class CallVisitor(ast.NodeVisitor):
      def visit_Call(self, node):
          print('Node type: Call\nFields: ', node._fields)
          ast.NodeVisitor.generic_visit(self, node)
  
      def visit_Name(self, node):
          print('Node type: Name\nFields: ', node._fields)
          ast.NodeVisitor.generic_visit(self, node)
  
      def visit_Constant(self, node):
          print('Node type: Constant\nFields: ', node._fields)
          ast.NodeVisitor.generic_visit(self, node)
  
      def visit_keyword(self, node):
          print('Node type: keyword\nFields: ', node._fields)
          ast.NodeVisitor.generic_visit(self, node)
  
      def visit_FunctionDef(self,node):
          print('Node type: FunctionDef\nFields:', node.fields)
          ast.NodeVisitor.generic_visit(self, node)
  
  
  if __name__ == '__main__':
      source = &quot;&quot;&quot;self.assertEqual(dictlike.fromkeys('a'), {'a':None})&quot;&quot;&quot;
  
      root = ast.parse(source)
      for node in ast.walk(root):
          if isinstance(node, ast.Name) and isinstance(node.ctx, ast.Store):
              print(node.id)
          elif isinstance(node, ast.Attribute):
              print(node.attr)
  </code></pre>
  <p>and I receive such output:</p>
  <pre><code>assertEqual
  fromkeys
  </code></pre>
  <p>I also tried to get it from the dump:
  print (ast.dump(node))</p>
  <p>but I didn't manage to get certain field:</p>
  <pre><code>Module(body=[Expr(value=Call(func=Attribute(value=Name(id='self', ctx=Load()), attr='assertEqual', ctx=Load()), args=[Call(func=Attribute(value=Name(id='dictlike', ctx=Load()), attr='fromkeys', ctx=Load()), args=[Constant(value='a', kind=None)], keywords=[]), Dict(keys=[Constant(value='a', kind=None)], values=[Constant(value=None, kind=None)])], keywords=[]))], type_ignores=[])
  </code></pre>
  <p>for example I tried such way:</p>
  <pre><code>print(node.args[0])
  </code></pre>
  <p>finally I would like to receive:</p>
  <pre><code>dictlike.fromkeys('a')
  </code></pre>
  <p>maybe I did something wrong ?</p>