~doctormo/python-snippets/lp-merge-request-example

« back to all changes in this revision

Viewing changes to pythoncore/stringcontainsstringtest.py

  • Committer: Jono Bacon
  • Date: 2010-01-10 20:35:59 UTC
  • Revision ID: jono@ubuntu.com-20100110203559-5v29tjelodmm0fxs
Added some core Python examples.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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."