I will post the code to convert the numerical value with △ and, described in the securities report to the numerical type that python can handle.
In the case of'△ 45,931'
test.py
moji='△45,931'
def conv(moji):
moji=moji.replace('△', '-')
moji=moji.split(' ')[-1]
moji=moji.replace(',', '')
moji=int(moji)
return moji
moji=conv(moji)
print(type(moji)) ##<class 'int'>
print(moji) ##-45931
In the case of'* 1 889,341'
test.py
moji='※1 889,341'
def conv(moji):
moji=moji.replace('△', '-')
moji=moji.split(' ')[-1]
moji=moji.replace(',', '')
moji=int(moji)
return moji
moji=conv(moji)
print(type(moji)) #<class 'int'>
print(moji) #889341
Recommended Posts