The invention discloses a method for preparing an aniline-pyrrole copolymer under assistance of microwaves. The method comprises steps as follows: 1, pyrrole, aniline and acid are added to deionized water for ultrasonic dispersion, and a mixed solution A is obtained; 2, an oxidizing agent, a surfactant and a catalyst are added to the deionized water for ultrasonic dispersion, and a mixed solutionB is obtained; 3, the mixed solution B is dropwise added to the mixed solution A for a microwave-assisted reaction, and slurry containing precipitates is obtained; 4, the slurry is centrifuged, the precipitates are collected, washing, centrifugation and vacuum drying are performed sequentially, and the aniline-pyrrole copolymer is obtained. The aniline-pyrrole copolymer is prepared under assistance of the microwaves, uniform and ordered growth of aniline and pyrrole molecules is promoted through radiation heating of aniline, pyrrole molecules and water by use of microwaves, the obtained aniline-pyrrole copolymer has a relatively loose 3D ordered structure and fewer defects, so that the pseudocapacitance of the aniline-pyrrole copolymer as an electrode material is improved, the cycle life of the aniline-pyrrole copolymer is prolonged, and the electric conductivity is improved.