Answer the question
In order to leave comments, you need to log in
Text editing. How to cut out the necessary fragments from an array of links?
There are a number of links to Facebook profiles, about 40,000.
They look something like this
https://www.facebook.com/profile.php?id=100056378844823
https://www.facebook.com/profile.php?id=100036605837335
https: //www.facebook.com/profile.php?id=100003312311771
You need to delete everything just so that the id remains. Something like this:
100056378844823
100036605837335
100003312311771
And to save it in txt or excel.
How can this procedure be implemented? excel, python, java
I would be very grateful for any information)
Answer the question
In order to leave comments, you need to log in
Python:
array = ['https://www.facebook.com/profile.php?id=100003312311771', 'https://www.facebook.com/profile.php?id=100036605837335']
for x in array:
res = x.split('php?id=')[1]
print(res)
with open('some.txt', 'a') as save:
save.write(res + '\n')
import re
inp_str = " https://www.facebook.com/profile.php?id=100003312311771 "
print("Original string : " + inp_str)
num = re.findall(r'\d+', inp_str)
print(num )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question