rm(list=ls()) remove all the variables from the workspace code example Example: how to keep only certian objects python rm(list=setdiff(ls(), "x"))