2016-12-26

Python - String replacement of anything between brackets or parenthesis (regex)

# [...]string_variable_name_here = "->[-asf asdf sd]<- br="">print re.sub( "\[(.*?)\]", "", string_variable_name_here )

# (...)string_variable_name_here = "->(-asf asdf sd)<- br="">print re.sub( "\((.*?)\)", "", string_variable_name_here )

No comments:

Post a Comment