0
I have a website and I need a name separation system:last name with list, the data is in a txt and I normally import the data is for example: maria:Carla Joao:lima wanted to be able to separate as follows when this print in data it would leave in different lists since the data are each in a line ['maria','Carla'] and ['Joao,'file'], and also separate as follows by variables, name = names[0]when giving a print in name would show ['Joao'] ['maria'],the first part of the code at the time ta so, it is only separating the first name:surname from the list also would like to solve this:
arquivo=raw_input("Digite o nome do arquivo para separar: ")
ler=open(arquivo)
with ler as f:
for line in f:
nome, sobrenome = line.split(":")
Thanks! I was in need
– Adriano guedes
I have another question, I am trying to send the data after to my site with import requests, however it is only sending the last name:last name and the first ones give error, will be q the problem is in this list system?
– Adriano guedes
actually has to do with the serialization of the object, basically you need to change the serialization of the object, the best way to send to another system through requests is envialos as json, I will edit the answer
– brow-joe
Edited answer, you will need to change the way to build your object, create the method that transforms the object to Dict and then yes can get the json, json vc can send via request
– brow-joe