I scraped and collected IDs from the Japanese horse racing information site. The array of ID is stored as a NumPy array. How can I add characters before and after each ID in this array?
import numpy as np
a = np.array([2019104896, 2016102929, 2018105085])
print(a) # [2019104896 2016102929 2018105085]
print(type(a)) # <class 'numpy.ndarray'>
b = a.astype(str)
c = "\n".join(b) # new line
with open('horse_id.txt', 'w') as f: # make a text file
f.write(c)
By executing the above code, I got the following text file.
horse_id.text
2019104896
2016102929
2018105085
I'd like to add characters before and after each ID like this:
'https://db.netkeiba.com/horse/' + ID + '/'
What I want to create is the following text file
horse_id.txt
https://db.netkeiba.com/horse/2019104896/
https://db.netkeiba.com/horse/2016102929/
https://db.netkeiba.com/horse/2018105085/
How can i achieve that?