Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
Alexandre Barbosa Gontijo

Erro string indice must integers Json


Sou novo no Python e estou "agarrado" em um problema, segue o código :

        response = requests.get("http://www.testecliente.com.br/ApiTeste/GetDadosCartaoCliente?CL_COD=1" )
        retorno = response.content
        retorno = retorno.decode("utf-8")
        json_data = json.loads(retorno)
       CL_NOME = json_data['CL_NOME']
       print ("NOME=" + CL_NOME)


aparece o seguinte erro :

TypeError : string indices must be integers 


se eu mando imprimir o json_data aparece :

    [{"CC_COD":16,"CL_COD":40,"CC_NUMERO_CARTAO":"68453217628884","CC_BANDEIRA":"visa","CC_VALIDADE":"09/21","CC_COD_SEGURANCA":"188","CC_FUNCAO":"C","CC_PRINCIPAL":"S","CL_NOME":"Alexandre Luiz"}]


alguém pode me ajudar ?

Edited by Alexandre Barbosa Gontijo

Share this post

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

Cloud Computing

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...