#!/usr/bin/env python
#python3中strip和eval函数的作用
#strip, 将某行字的两端空格去掉
sentence1 = " He is Handsome! "
length1 = len(sentence1)
print("去除空格前的长度", length1)
strip_1 = sentence1.strip()
print(strip_1)
length2 = len(strip_1)
print("去除空格后的长度", length2 )
#eval, 把某个字符串变成数字
sentense2 = "12306"
print(sentense2)
print("它的数据类型:", type(sentense2))
eval_1 = eval(sentense2)
print(eval_1)
print("它的数据类型:", type(eval_1))
执行结果: