Here is my problem. I have various integer inputs varying in length, but I only want certain number prefixes to be printed. The prefix ranges are 20000-20150 all five digits. So far I have:
print 20000 <= prefix <= 20150
which is fine, but how do I find or capture the prefix ‘20000’ in the number using Python.
example:20000201501
using the code below won’t work, in such cases because there are two instances where the value of prefix is present, I only want the first prefix.
obj = 20000201501
if prefix in obj
print prefix
Very simply:
So, you need something like this: