I extracted lots of names from internet, how can i creat a list of them? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I extracted lots of names from internet, how can i creat a list of them?

19th Sep 2021, 3:25 PM
Elham
Elham - avatar
15 Answers
+ 4
Isn't it better to store the names in a text file and read it into the list using a program?
20th Sep 2021, 10:53 PM
Sonic
Sonic - avatar
+ 1
Could I please know which language you are referring to, and in what form the names are in (e.g. a txt file)
19th Sep 2021, 3:30 PM
Kamil Hamid
Kamil Hamid - avatar
+ 1
Sure, in python, names are texts
19th Sep 2021, 3:31 PM
Elham
Elham - avatar
+ 1
I have extracted them like this: Sarah fath Iman nejati Hamid amiri Ali mosavi
19th Sep 2021, 3:35 PM
Elham
Elham - avatar
+ 1
They are not in a file, I wrote the code and know I can see them in python like that
19th Sep 2021, 3:42 PM
Elham
Elham - avatar
+ 1
Each name comes from a unique url
19th Sep 2021, 3:43 PM
Elham
Elham - avatar
+ 1
"If you can see them, you can add them to a list". (Dr Ali Shariati) :D list = [] list.append("Sara")
19th Sep 2021, 4:00 PM
Arsalan [Inactive]
Arsalan [Inactive] - avatar
+ 1
There are thousands names
19th Sep 2021, 4:03 PM
Elham
Elham - avatar
+ 1
I found it, thank you for your nice coopration😊
19th Sep 2021, 4:05 PM
Elham
Elham - avatar
+ 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
19th Sep 2021, 4:17 PM
Elham
Elham - avatar
0
So are the names in a .txt file?
19th Sep 2021, 3:34 PM
Kamil Hamid
Kamil Hamid - avatar
0
Could you share your code ?
19th Sep 2021, 3:52 PM
Aravind Shetty
Aravind Shetty - avatar
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
19th Sep 2021, 3:55 PM
Kamil Hamid
Kamil Hamid - avatar
0
We have append method for lists. x.append(i) instead of x = x + [i]
20th Sep 2021, 2:17 PM
Aravind Shetty
Aravind Shetty - avatar
0
Use the append method for list Better way ;) Creat a file write the data in it then play as you want ;)
20th Sep 2021, 4:21 PM
Liaichi Mustapha
Liaichi Mustapha - avatar