Although one-dimensional polymer nanomaterials can be prepared by approaches such as the template method, the control over the morphologies of one-dimensional polymer nanomaterials containing multiple components is still a great challenge. In this work, we investigate the formation of polymer nanopeapods using a novel double-solution wetting method in the nanopores of anodic aluminum oxide (AAO) templates. A polystyrene (PS) solution in dimethylformamide (DMF) is first introduced into the nanopores of the AAO templates. Then a second polymer solution of poly(methyl methacrylate) (PMMA) in acetic acid is infiltrated into the nanopores. Because of the stronger interaction between acetic acid and aluminum oxide than that between DMF and aluminum oxide, the PMMA solution preferentially wets the pore walls of the templates and the PS solution is isolated in the center of the nanopores. After the evaporation of the solvent, peapod-like PS/PMMA nanostructures are obtained, where the shell and the core are composed of PMMA and PS, respectively. The compositions of the polymer nanopeapods are confirmed by removing PS or PMMA selectively. The formation mechanism of the nanostructures is related to the Rayleigh-instability-type transformation and further studied by changing experimental parameters such as the polymer concentration or the polymer molecular weight. This work not only provides a simple approach to prepare multicomponent polymer nanomaterials with controlled morphologies and sizes, but also contributes to a deeper understanding of polymer-solvent interactions in confined geometries.