【Python爬虫】- 8.12练习题

a = 'I'
b = 'like'
c = 'python'
print("'", a, b, c, "'")

result:

' I like python '
s = ' sdghHhf '
s1 = s.strip()
print(s1)
s2 = s1.upper()
s3 = s1.lower()
print(s2, s3)
s4 = s1.find('h')
print(s4)

result:

sdghHhf
SDGHHHF sdghhhf
3
x = 'I {} python'
x1 = x.format('like')
x2 = x.replace('{}', 'like')
print(x1)
print(x2)

result:

I like python
I like python
capital = '人民币100万元'
print(len(capital))
print(capital.isdigit())

result:

8
False

你可能感兴趣的:(【Python爬虫】- 8.12练习题)