python学习,第二天札记

python学习,第二天笔记
#强制转换
#a = "1";
#b = "2";
#print a + b;
#print int(a) + int(b);
#12
#3

#首字母大写
#a = "please call me ck";
#b = "PLEASE CALL ME CK";
#print a.capitalize();
#print b.capitalize();
#Please call me ck
#Please call me ck

#大小写互换
#a = "My name is CK";
#print a.swapcase();
#mY NAME IS ck

#截取字符串
#a = "call me ck";
#print a[0:6];
#call m

#各种判断
#a = "Abcdef";
#print a.isalpha();#所有字符都是A-Z或a-z
#print a.isalnum();#是否所有字符都是数字或者A-Z或者a-z
#print a.isdigit();#是否所有字符都是数字
#print a.islower();#是否都是小写
#print a.isupper();#是否都是大写
#print a.istitle();#是否首字母为大写
#print a.isspace();#是否所有字符都是空白符n,t,r,' '
#True
#True
#False
#False
#False
#True
#False

#在字符串查找子串
#a = "my name is ck ck";
#print a.find("ck"); #
#print a.find("my", 1);#从1开始查找字符串
#print a.rfind("ck");#反向查找字符串
#11
#-1
#14

相关内容推荐