I have this array
['95.65€', '', '10', '€', '5€']
I just want to print the index which contains any number and the € symbol.
For example, that would be for the top array 95.65€ and 5€.
But how?
content = ['95.65€', '', '10', '€', '5€']
for i in content:
if "€" in i: # And Number??
print(i)
CodePudding user response:
a = ['95.65€', '', '10', '€', '5€']
for idx, ele in enumerate(a):
if '€' in ele and any(c.isdigit() for c in ele):
print(f'index {idx}: {ele}')
# Output:
# index 0: 95.65€
# index 4: 5€