App_height1=root.winfo_geometry() App_height = re.sub('\+[0-9]\+[0-9]', '', App_height1, count=0) App_height=re.sub ('[0-9]+x', '', App_height) print App_height """ output 718+341+41 718+341+41 718+341+41 718+341+41 718+341+41 718+341+41 from command line >>> foo="610x349+1+1" >>> foo = re.sub('\+[0-9]\+[0-9]', '', foo, count=0) >>> print foo 610x349 >>> foo = re.sub ('[0-9]+x', '', foo) >>> print foo 349 >>>