The weighted Lebesgue and Hardy spaces with a general weight are considered. Basicity of a part of exponential system is proved in Hardy classes, where the weight satisfies the Muckenhoupt condition. Using these results the basicity of the perturbed system of exponents in the weighted Lebesgue space is studied. Some special cases are considered.