-
Notifications
You must be signed in to change notification settings - Fork 0
/
to change or not change.py
52 lines (46 loc) · 998 Bytes
/
to change or not change.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# This Python file uses the following encoding: utf-8
#修改字符串
#思想,现变成一个列表再改变
teststr = 'helli world'
# print(type(teststr))
#1
# tmp = []
# for i in teststr:
# tmp.append(i)
# print(tmp)
# tmp[4] = 'o'
# endstr = ''.join(tmp)
# print(endstr)
# #默认参数的影响情况,默认参数为可变参数的时候
# class Stu():
# def __init__(self, course=[]):
# print(course)
# self.course = course
#
# def appcouse(self, course):
# self.course.append(course)
#
#
# a = Stu()
# a.appcouse('english')
# a.appcouse('math')
# print(a.course)
#
# b = Stu()
# print(b.course)
#常用列表解析式,还有字典解析式,元组也可以元组这样就是一个生成器
# a = [2, 2, 3, 4, 5]
# b = [2, 2, 4, 5]
# c = (i for i in a if i not in b)
# print(next(c))
# print(next(c))
#
# import time
# def report(when = time.time()):
# print(when)
#
#
# def report2(when=time.time):
# print(when)
# report()
# report2()