Python爬虫第一、二次作业

#1.第一次-课后习题

##1.基础题

··· 

a=10

 b=3

print(a/b-a)

 print(type(a/b-a))

 print(a/b*a)

 print(type(a/b*a))

 d=0.1

 print(d*a//b-a)

print(type(d*a//b-a))

 print(a//b+a%b)

 print(type(a//b+a%b))

···

#第二次-字符串练习题

##一、定义字符串变量

###1.请定义三个字符串a,b,c值分别为 I,like, python

···

a=”I “

b=”like “

c=”python”

“`

###2.请将上面三个变量合并输出’I like python’

“`

print(a+b+c)

“`

##定义一个变量 s=’ sdghHhf ‘

“`

s=’ sdghHgf ‘

print(s.strip())

s1=’sdghHgf’

print(s1.upper())

s1=’sdghHgf’

print(s1.lower())

s1=’sdghHgf’

print(s1.find(‘h’))

“`

##三、定义一个变量x=’I {} pyhon’

“`

x=’I {} python’

print(x.replace(‘{}’,’like’))

print(‘I {} python’.format(‘like’))

“`

##四、定义一个变量capital=’人民币100万元’

“`

capital=’人民币100万元’

print(len(capital))

print(capital.isdigit())

“`

    原文作者:小白龙_275b
    原文地址: https://www.jianshu.com/p/9b99517f28a6
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞