Posted in Python onJuly 20, 2019
如下所示:
import os var = [1, 2, 3] data = [x*2 for x in var] print (data) two = [[i, i**2] for i in var] print (two) three = [[i, i+i, i**3] for i in var] print (three) fruit = [' banana', ' loganberry ', 'passion fruit '] strip_fruit = [one.strip() for one in fruit] print (strip_fruit)
以上这篇python列表每个元素同增同减和列表元素去空格的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。
python列表每个元素同增同减和列表元素去空格的实例
- Author -
微小东声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@