python: 字符串按空格分成列表split与加密密码maketrans
#字符串按空格分成列表split()
print("fu li mei".split()) #split按空格分成列表
print("1+a+2+b".split('+')) #split按空格分成列表#应用场景--只提取数字 #加密密码
p=str.maketrans("hgx",'123')
print("zhangsan xing".translate(p))
python: 字符串按空格分成列表split与加密密码maketrans的更多相关文章
- Python字符串,元组、列表、字典
1.字符串 <string>.strip() 去掉两边空格及去指定字符 <string>.split() 按指定字符分隔字符串为数组 <string>.isdigi ...
- Python字符串、元组、列表、字典互相转换的方法
直接上代码!!! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...
- python 字符串,元组, 列表,字典之间的转换
#-*-coding:utf-8-*- #1.字典 dict = {'name': 'Zara', 'age': 7, 'class': 'First'} #字典转为字符串,返回:<type ' ...
- (备忘)Python字符串、元组、列表、字典互相转换的方法
#1.字典 dict = {'name': 'Zara', 'age': 7, 'class': 'First'} #字典转为字符串,返回:<type 'str'> {'age': 7, ...
- python字符串、元组常用操作
常用字符串操作函数: #Author:CGQ name="I \tam ChenGuoQiang" print(name.capitalize())#首字母大写,其他都小写 pri ...
- python整理之(字符串、元组、列表、字典)
一.关于字符串的整理总结 对于字符串的操作常用的有这些: 字符串的操作通过dir()函数可以查看 我们先整理没有下划线的用法,有下划线的暂时不去考虑. 1.capitalize 功能:使字符串的首字母 ...
- 【C++实现python字符串函数库】一:分割函数:split、rsplit
[C++实现python字符串函数库]split()与rsplit()方法 前言 本系列文章将介绍python提供的字符串函数,并尝试使用C++来实现这些函数.这些C++函数在这里做单独的分析,最后我 ...
- Python第五天 文件访问 for循环访问文件 while循环访问文件 字符串的startswith函数和split函数 linecache模块
Python第五天 文件访问 for循环访问文件 while循环访问文件 字符串的startswith函数和split函数 linecache模块 目录 Pycharm使用技巧( ...
- Python中常见字符串去除空格的方法总结
Python中常见字符串去除空格的方法总结 1:strip()方法,去除字符串开头或者结尾的空格>>> a = " a b c ">>> a.s ...
随机推荐
- UISwitch属性
1.onTintColor 处于on时switch 的颜色 switchImage.onTintColor = [UIColor grayColor]; 2.tintColor 处于off时s ...
- Java基础之集合框架——使用真的的链表LinkedList<>(TryPolyLine)
控制台程序. public class Point { // Create a point from its coordinates public Point(double xVal, double ...
- G面经Prepare: Valid Preorder traversal serialized String
求问下各位大神,怎么判断一个按照Preorder traversal serialized的binary tree的序列是否正确呢?不能deserialize成树比如 A) 9 3 4 # # 1 # ...
- 写了个pager, 可供参考
/* Author: Calos Description: patv2 pager !import: this pager goes with the time, we just temporaril ...
- zjuoj The 12th Zhejiang Provincial Collegiate Programming Contest Ace of Aces
http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5493 The 12th Zhejiang Provincial ...
- [原创]java WEB学习笔记87:Hibernate学习之路-- -映射 继承关系(subclass , joined-subclass,union-subclass )
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...
- [转] java编程规范
原文链接: 资料推荐--Google Java编码规范 之前已经推荐过Google的Java编码规范英文版了: http://google-styleguide.googlecode.com/svn/ ...
- B/S与C/S区别
B/S (Brower/Server)-->浏览器/服务器 程序完全部署在服务器上,用户通过浏览器访问应用程序,它是基于internet产物(在应用服务器中部署运行程序) c/s(Client/ ...
- HDU 3686 Traffic Real Time Query System(双连通分量缩点+LCA)(2010 Asia Hangzhou Regional Contest)
Problem Description City C is really a nightmare of all drivers for its traffic jams. To solve the t ...
- 杭电ACM分类
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...