By using the first-principles method based on density functional theory, we investigate the structural and electrical properties of the small radius (4, 0) single-walled carbon nanotubes (SWCNTs) in which one or more carbon atoms are substituted by one or more nitrogen (N) atoms. Results show that substitution of nitrogen alters the electrical properties and the global structure of the tube in some way. The conductivity of the metallic (4, 0) SWCNT weaken and an energy gap opens after doping nitrogen atoms. Meanwhile, the further research tells us that a large dosage concentration will bring a large change to the band structure for the SWCNTs.