I have a text file that has a variable length of digits ('62554' could be 'xxxx' or 'xxx')
# cat dsset-domain.com.
domain.com. IN DS 62554 8 1 84988C2B6D3C92F35E1457D3771D0270417622D2
domain.com. IN DS 62554 8 2 EF940E2D5CFAD8B47A699ACCD68A77C43F120774CABCCA5A25443BE3 1D1BEABF
I need the last 4 strings of the first line assigned to list variables:
list[0] = 62554
list[1] = 8
list[2] = 1
list[3] = 84988C2B6D3C92F35E1457D3771D0270417622D2
But I don't exactly have a delimiter to work with.
What is the best way to slice up a line of strings of variable length and assign them as list elements?
code:
#!/usr/bin/python
import string
import requests
name = input("Enter the domain to provision DS keys for? ")
url = 'https://www.provider.net/ws/domain/'+name+'/ds'
with open('/usr/local/etc/namedb/dsset-'+name+'.', 'rt') as in_file:
dstext = in_file.read()
print(dstext)