This file contains hidden or 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
public static String stripTags(String input) { | |
return input.replaceAll("\\<.*?>",""); | |
} |
This file contains hidden or 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
#用正则简单过滤html的<>标签 | |
import re | |
str = "<img /><a>srcd</a>hello</br><br/>" | |
str = re.sub(r'</?\w+[^>]*>','',str) | |
print str |
This file contains hidden or 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
# Define a procedure, measure_udacity, | |
# that takes as its input a list of strings, | |
# and returns a number that is a count | |
# of the number of elements in the input | |
# list that start with the uppercase | |
# letter 'U'. | |
def measure_udacity(p): | |
result = 0 |
This file contains hidden or 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
# Define a procedure, sum_list, | |
# that takes as its input a | |
# list of numbers, and returns | |
# the sum of all the elements in | |
# the input list. | |
def sum_list(p): | |
result = 0 | |
for i in p: |