+ 2
I extracted lots of names from internet, how can i creat a list of them?
15 odpowiedzi
+ 4
Isn't it better to store the names in a text file and read it into the list using a program?
+ 1
Could I please know which language you are referring to, and in what form the names are in (e.g. a txt file)
+ 1
Sure, in python, names are texts
+ 1
I have extracted them like this:
Sarah fath
Iman nejati
Hamid amiri
Ali mosavi
+ 1
They are not in a file, I wrote the code and know I can see them in python like that
+ 1
Each name comes from a unique url
+ 1
"If you can see them, you can add them to a list". (Dr Ali Shariati) :D
list = []
list.append("Sara")
+ 1
There are thousands names
+ 1
I found it, thank you for your nice coopration😊
+ 1
x=[]
for i in range(10):
x=x+[i]
print(x)
It was so easy, but my mistake was that I would write it in a loop while it shoulb be out of that
0
So are the names in a .txt file?
0
Could you share your code ?
0
To create a list, you create a name, let’s say nameList:
nameList=[item1,item2,item3,item4]
Where each item is a name in this case
0
We have append method for lists. x.append(i) instead of x = x + [i]
0
Use the append method for list
Better way ;)
Creat a file write the data in it then play as you want ;)