importing assignment into modul re/expected string or buffer Python, -


well started learning python don't understand how make code correct (worth learn youtube))). want code -- if assignment num1 has 8 in end , should printed command print, , if doesn't print nothing.

import re  def x():     num1 = 5894652138     vav = re.match(r'[8]''$', num1)     print vav    x() 

you don't need use re here. check last digit in decimal number, should use modulos 10:

num1 = 5894652138 if num1 % 10 == 8:     print num1    

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -