Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (27 sloc) 895 Bytes
import string
import types
def convert_to_identifier(s0):
s1 = string.replace(s0," ","_")
s2 = string.replace(s1,"'","_")
s3 = string.replace(s2,"`","_")
s4 = string.replace(s3,"(","_")
s5 = string.replace(s4,")","_")
s6 = string.replace(s5,"-","_")
s7 = string.replace(s6,",","")
s8 = string.replace(s7,"|","")
s9 = string.replace(s8,"\t","_") #Tab
s10 = string.lower(s9)
return s10
def convert_to_identifier_with_no_lowercase(s0):
s1 = string.replace(s0," ","_")
s2 = string.replace(s1,"'","_")
s3 = string.replace(s2,"`","_")
s4 = string.replace(s3,"(","_")
s5 = string.replace(s4,")","_")
s6 = string.replace(s5,"-","_")
s7 = string.replace(s6,",","")
s8 = string.replace(s7,"|","")
s9 = string.replace(s8,"\t","_") #Tab
return s9
def replace_spaces(s0):
return string.replace(string.replace(s0,"\t","_")," ","_")