Poly(pyrrole-co-aniline) (PPyA) copolymer nanofibers were prepared by chemical oxidation method with cetyltrimethyl ammonium chloride (CTAC) as template, and the nano-sulfur/poly(pyrrole-co-aniline) (S/PPyA) composite material in lithium batteries was achieved via co-heating the mixture of PPyA and sublimed sulfur at 160°C for 24h. The component and structure of the materials were characterized by FTIR, Raman, XRD, and SEM. PPyA with nanofiber network structure was employed as a conductive matrix, adsorbing agent and firm reaction chamber for the sulfur cathode materials. The nano-dispersed composite exhibited a specific capacity up to 1285mAhg−1 in the initial cycle and remained 866mAhg−1 after 40 cycles.