+ 1
Some help to finish this code in notebook, please
https://code.sololearn.com/cRW56iI21SGe '''Create a class called Person. This class will contain as its attributes: name, ID, address, phone number. By method we will only take into consideration that it will print the person's data on the screen. Use this Person class to create a list of persons and display each of them. The data of each person must be in a file called personas.txt. The format of this file is one line with the data for each person. They are separated by ';'. It contains information in this order: nombre; DNI; direcciĆ³n; pepe;2345; calle uno, 899023 sara;2346; calle dos, 167890 juan;4567; calle tres, 906089 '''
5 Answers
+ 2
Next all you need is :
creates data for persons by objects like
persena(pepe;2345; calle uno, 899023)
and add these to a file by creating a new file.
as like
lineas = open('c:\ejemplo\personas.txt', 'w')
write objects into file.
next
then open same file in read mode and readlines into a list then display data..
as
lineas = open('c:\ejemplo\personas.txt', 'r').readlines()
display by a loop.
+ 7
This example will help you:
https://code.sololearn.com/cD4meOQuDomK/?ref=app
+ 5
You have No closing quote for file open
Use
lineas = open('c:\ejemplo\personas.txt'). readlines()
And your class name is persona as you defined but using Persona (capital P)
Hope it helps..
+ 4
https://code.sololearn.com/c7qKpO18WaCJ/?ref=app
you have to return a string in the string dunder. then youre able to just call print on a Persona object. You also need to capitalize the 'p' in the class decleration
- 1
I change a lit bit, what do you mean as ācapitalizeā
Slick your code is so diferent than man that itās difficult for me understain