import res1 = '1080p [2.1GB] 720p [1.3GB] 480p [500MB]'s2 = re.sub(r"\s*\[.*?\]", ",", s1)print s2.strip(' ,')
Standard input is empty
1080p, 720p, 480p
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!