For the global health crisis COVID-19, the radio-logical imaging techniques CT have demonstrated effectiveness in both current diagnosis and evaluation of disease evolution. However, the manual delineation of lung infections is tedious and time-consuming work, and infection annotation by radiologists is a highly subjective task, often influenced by individual bias and clinical experiences. To address these challenges, we proposed a transformer learning method (Trans-Inf-Net) to automatically identify infected regions from chest CT slices. In our Trans-Inf-Net, a parallel partial decoder is used to aggregate the high-level features and generate a global map. Then, the implicit reverse attention and explicit edge-attention are utilized to model the boundaries and enhance the representations. Moreover, to alleviate the shortage of labeled data, we present a segmentation framework based on a randomly selected propagation strategy and transformer, which only requires a few labeled images and leverages primarily unlabeled data. We apply attention in conjunction with convolutional networks, while keeping their overall structure in place. a pure transformer applied directly to sequences of image patches can perform very well on image segmentation tasks. Our framework can improve the learning ability and achieve a higher performance. Extensive experiments on COVID-SemiSeg and real CT volumes demonstrate that the proposed Trans-Inf-Net outperforms most cutting-edge segmen-tation models and advances the state-of-the-art performance.