【Python爬虫】-8/16课后作业

#2

s1='http://www.jianshu.com/u/5b5a9a0eac12'

s2=s1[-12::]

print(s2)

#3

s="abcdefg"

print(s[3])

print(s[:5])

print(s[::-1])

print(s[2:4])

print(s[3:])

print(s[::2])

#4

list1=[1,2,3,4,5,6,7]

print(list1[3])

print(list1[:5])

print(list1[::-1])

print(list1[2:4])

print(list1[3:])

print(list1[::2])

#5

touple1=(1,2,3,4,5,6,7)

print(touple1[3])

print(touple1[:5])

print(touple1[::-1])

print(touple1[2:4])

print(touple1[3:])

print(touple1[::2])



Print out


5b5a9a0eac12

d

abcde

gfedcba

cd

defg

aceg

4

[1, 2, 3, 4, 5]

[7, 6, 5, 4, 3, 2, 1]

[3, 4]

[4, 5, 6, 7]

[1, 3, 5, 7]

4

(1, 2, 3, 4, 5)

(7, 6, 5, 4, 3, 2, 1)

(3, 4)

(4, 5, 6, 7)

(1, 3, 5, 7)

你可能感兴趣的:(【Python爬虫】-8/16课后作业)