The optical nonlinearity of WS2, MoS2 monolayer and few-layer films was investigated using the Z-scan technique with femtosecond pulses from the visible to the near infrared. The dependence of nonlinear absorption of the WS2 and MoS2 films on layer number and excitation wavelength was studied systematically. WS2 with 1~3 layers exhibits a giant two-photon absorption (TPA) coefficient. Saturation of TPA for WS2 with 1~3 layers and MoS2 with 25~27 layers was observed. The giant nonlinearity of WS2 and MoS2 is attributed to two dimensional confinement, a giant exciton effect and the band edge resonance of TPA.