1、ord():查ASCII码;chr():查对应的字符;
2、Python读写文件:
#文件写入
with open('E:\Python\learnngu\samplefile.txt','wt') as outfile:
outfile.write('Please keep')
#文件读
with open('E:\Python\learnngu\samplefile.txt','rt') as outfile1:
c = outfile1.read()
print(c)
3、字符判定与转换():
inp = 'the beauty will come'
print(inp.isalnum()) # 判断所有字符都是数字或者字母
print(inp.isalpha()) # 判断所有字符都是字母
print(inp.isdigit()) # 判断所有字符都是数字
print(inp.islower()) # 判断所有字符都是小写
print(inp.isupper()) # 判断所有字符都是大写
print(inp.istitle()) # 判断所有单词都是首字母大写,像标题
print(inp.isspace()) # 判断所有字符都是空白字符、\t、\n、\r
inp = "the beauty will come"
print(inp.upper()) # 把所有字符中的小写字母转换成大写字母
print(inp.lower()) # 把所有字符中的大写字母转换成小写字母
print(inp.capitalize()) # 把第一个字母转化为大写字母,其余小写
print(inp.title()) # 把每个单词的第一个字母转化为大写,其余小写