job = ''.join([i for i in job if not i.isdigit()])
Error text:
job = ''.join([i for i in job if not i.isdigit()]) TypeError: 'float' object is not iterable
CodePudding user response:
The operative part here is 'in job'.
If you run print(job)
before the line in question, you'll see that the job variable is a floating-point number, not something iterable like a list or set.
Make sure job is iterable. If the error isn't resolved, it would be helpful if you pasted the output of print(job)
with the question.
CodePudding user response:
Because isdigit
is a string method, I assume you are trying to iterate over the characters in a string and remove all digits. If this is the case, you can cast job
to be a string in the list comprehension:
job = ''.join([i for i in str(job) if not i.isdigit()])