Python determines whether a string contains another string

From , 5 Years ago, written in Python, viewed 79 times.
URL https://pastebin.vip/view/5ef99d16
  1. #!/usr/bin/env python
  2. #
  3. # [SNIPPET_NAME: String contains string test]
  4. # [SNIPPET_CATEGORIES: Python Core]
  5. # [SNIPPET_DESCRIPTION: Test if a string contains another string]
  6. # [SNIPPET_AUTHOR: Jono Bacon <jono@ubuntu.com>]
  7. # [SNIPPET_LICENSE: GPL]
  8.  
  9.  
  10. my_string = "abcdef"
  11.  
  12. if "abc" in my_string:
  13.     has_abc = True
  14.  
  15. if has_abc == True:
  16.     print "String contains string."
  17. #//python/2367

Reply to "Python determines whether a string contains another string"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website