Created
January 10, 2014 06:54
-
-
Save elpargo/8347945 to your computer and use it in GitHub Desktop.
For Conrado :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> str1 = 'There are two types of people in the world' | |
>>> str2 = 'Hello my name is caonabo welcome to dominican republic' | |
>>> str2.split(' ') | |
['Hello', 'my', 'name', 'is', 'caonabo', 'welcome', 'to', 'dominican', 'republic'] | |
# El default de split es ASCII 32 so | |
>>> str2.split() | |
['Hello', 'my', 'name', 'is', 'caonabo', 'welcome', 'to', 'dominican', 'republic'] | |
#no te compliques con chr | |
>>> [s for s in str1.split() if s[0] == 'w'] | |
['world'] | |
#asi es aun mas facil | |
>>> [s for s in str1.split() if s == 'world'] | |
['world'] | |
#check this one :D | |
>>> print " ".join([i for i in ["Hello","world"] if i in "{} {}".format(str1,str2)]) | |
Hello world | |
#Wlecome :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment