美文网首页Python五期爬虫作业
【Python爬虫作业】- 字符串

【Python爬虫作业】- 字符串

作者: 丽雁解 | 来源:发表于2017-12-20 21:21 被阅读15次

第一题

a="I"
b="like"
c="python"

d=a+" "+b+" "+c

print(d)

第二题

s="   sdghHhf   "

s1=s.strip(" ")
print("s1=",s1)

s2=s.upper()
print("s2=",s2)

s3=s.lower()
print("s3=",s3)

s4=s1.find("h")
print("s4=",s4)

第三题

x='I {} python'

x1="I {} python".format("like")
print("x1=",x1)

x2=x.replace("{}","like")
print("x2=",x2)

第四题

capital='人民币100万元'

print("'",capital,"'","的长度是:",len(capital))
print("'",capital,"'","是否为数字?:",capital.isdigit())

相关文章

网友评论

    本文标题:【Python爬虫作业】- 字符串

    本文链接:https://www.haomeiwen.com/subject/poynwxtx.html