Materials with electrically tunable optical properties offer a wide range of opportunities for photonic applications. The optical properties of the single-walled carbon nanotubes (SWCNTs) can be significantly altered in the near-infrared region by means of electrochemical doping. The states' filling, which is responsible for the optical absorption suppression under doping, also alters the nonlinear optical response of the material. Here, for the first time we report that the electrochemical doping can tailor the nonlinear optical absorption of SWCNT films and demonstrate its application to control pulsed fiber laser generation. With a pump-probe technique, we show that under an applied voltage below 2 V the photobleaching of the material can be gradually reduced and even turned to photoinduced absorption. Furthermore, we integrated a carbon nanotube electrochemical cell on a side-polished fiber to tune the absorption saturation and implemented it into the fully polarization-maintaining fiber laser. We show that the pulse generation regime can be reversibly switched between femtosecond mode-locking and microsecond Q-switching using different gate voltages. This approach paves the road toward carbon nanotube optical devices with tunable nonlinearity.