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

javascript - Can Piwik report referrer in real time? -

asp.net - Google Drive Access: At least one client secrets (Installed or Web) should be set -

excel vba add hyperlink to shape in group -