Piperazine polymers poly(ethylenediaminetetraacetic dianhydride‐co‐piperazine) (PE) and MGF‐Ct24E‐modified poly(ethylenediaminetetraacetic dianhydride‐co‐piperazine) (PEM) showed good antibacterial activity. Considering their different applications, the effects of time, pH, and inoculation concentration of these antibacterials against Escherichia coli (E. coli) in unique environments were evaluated in this study. The results indicated that the MIC and MBC values of the polymers increased after the introduction of MGF‐Ct24E into PE, but the two types of polymers still exhibited good antibacterial activity in a short time period under acidic conditions. In addition, we investigated the effect of the piperazine polymers on bacterial cell structure. It was clear that PE and PEM could destroy the bacterial cell wall, cell membrane and DNA, and their specific mechanism may be different. For PE, its carboxyl group could react with peptidoglycans on the E.coli cell wall to form holes on the bacterial surface, allowing PE to penetrate into the bacterial cell to damage DNA. For PEM, the alkaline MGF‐Ct24E could adsorb E.coli and make it shrink, meanwhile, the PE component created small holes on the bacterial walls and membranes, and inserted into the bacteria to result in bactericidal effect. These findings reveal the potential usefulness of PE and PEM in biomedical applications.