科学网

 找回密码
  注册
python的map和zip操作
郑俊娟 2014-4-11 01:14
如果要将一个string list转换成int list (list里每个string都转成int),比如 view plain copy - 可以使用: view plain copy 或者使用map操作: map(func, list) 对list里的每个元素apply func. view plain copy ...
个人分类: python|3054 次阅读|没有评论
Python strip lstrip rstrip使用方法
郑俊娟 2014-4-10 17:59
Python中的strip用于去除字符串的 首尾 字符,同理,lstrip用于去除 左边 的字符,rstrip用于去除 右边 的字符。 这三个函数都可传入一个参数,指定要去除的首尾字符。 需要注意的是,传入的是一个 字符数组 ,编译器去除两端所有相应的字符,直到没有匹配的字符,比如: theString ='saaaay yes no ...
个人分类: python|2810 次阅读|没有评论

本页有 8 篇博文因作者的隐私设置或未通过审核而隐藏

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-19 19:54

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部