Isdigit how does it work when a number is in a string

Hello,

my first script works well:

OUT = []

for i in strings:
    OUT.append(i.isdigit())

my idea was to make a double for loop, but it makes for each letter a boolean insteat of each index:

OUT = []

for c in strings:
    for i in c:
         OUT.append(i.isdigit())


How can i just say , this string contains a digit?

KR

Andreas

Look into regular expressions.

import re
txtList = IN[0]
results = []
for str in txtList:
	test = re.findall("\d",str)
	results.append(len(test)>0)
OUT = results

If you want to know just what numbers were used, modify the results.append line to “results.append(test)”

2 Likes