Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
NormalizeTags
#python 2.7.12 def NormalizeTag(TagToClean): NormalizedTag = list(TagToClean) CharsToRemove = (' ', '\'') CharsToReplace = {'&': '-', '/': '-', ',':'-'} i = 0 for Letter in NormalizedTag: if Letter in CharsToReplace: print "'" + Letter + "' needs to be replaced with '",CharsToReplace[Letter],"'" NormalizedTag[i] = CharsToReplace[Letter] elif Letter in CharsToRemove: print "'" + Letter + "' needs to be removed" NormalizedTag.remove(Letter) i += 1 #print str(NormalizedTag) return "".join(NormalizedTag) print "RON'S -->",NormalizeTag("RON'S") print "CONSUMER SALES & MARKETING -->",NormalizeTag("CONSUMER SALES & MARKETING") print "CORPORATE, OTHER -->", NormalizeTag("CORPORATE, OTHER") print "NEWS/SPORTS -->", NormalizeTag("NEWS/SPORTS") print "TECHNOLOGY - TOM & LARRY -->", NormalizeTag("TECHNOLOGY - TOM & LARRY")
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Lambda
pi1
Dictionary
Filter dictionaries with specific keys (using list comprehension)
GayChicken
check if any permutations of a word is a palindrome - python
Cofe
Nama Bulan Python
MPS encoding
bacs_class
Please log in to post a comment.