I'm attempting to store a list of valid ip addresses in a cell using openpyxl. At the moment the data is simply placed into a cell, and usually overflows into other cells. Using the code below:
# Regex to return a tidy list of ip addresses in that block
"""
r = row to be checked
s = source or destination columns
iptc = ips to check
"""
def regex_ips(r, s):
iptc = ['165.11.14.20', '166.22.24.0/24', '174.68.19.11', '165.211.20.0/23']
if r is not None:
if s is not None:
iptc = str(sheet.cell(r, s).value)
san = re.sub('\n', ', ', iptc)
sheet_report.cell(r, 8).value = san
However, I would prefer if i could place these ip addresses into a dropdown list since that would be far easier to read - so my question is twofold, first, can this be done? because I couldn't find any info about it, And secondly, is there possibly a better way to display the data without it overflowing?
Thanks for reading over this
EDIT: added some example addresses and subnets to reflect what may be in a list.
iptc
,or a list of some examples ips, or how are they store. – Vdayiptc = ["165.11.14.20", "166.22.24.0/24", "174.68.19.11", "165.211.20.0/23"]
– Vday