Skip to content

Instantly share code, notes, and snippets.

View time04.py
import calendar
#calendar.month(年, 月)
print(calendar.month(2020, 5))
View time03.py
import time
t = time.time()
result = time.ctime(t)
print(result)
View time02.py
import time
result = time.localtime()
print(result)
View time01.py
import time
time = time.time()
print(time)
result = time / (24 * 60 * 60 * 365) + 1970
print(result)
View set0.py
set1 = {1,2,3}
set2 = set((1, 2, 3))
print(set1) # 打印出{1, 2, 3}
print(set2) # 打印出{1, 2, 3}
View sey_02.py
a = {1,2,3}
a.remove(1)
print(a)
# 打印出{2, 3}
View set_01.py
a = {1, 2, 3}
a.add(4)
print(a)
# 打印出{1, 2, 3, 4}
View dict_12.py
person = {'name': 'Amy', 'age': '18'}
for i in person.items():
print(i)
# 打印出('name', 'Amy') ('age', '18')
View dict_.py
person = {'name': 'Amy', 'age': '18'}
for i in person.values():
print(i)
# 打印出 Amy 18
View dict_10.py
person = {'name': 'Amy', 'age': '18'}
for i in person.keys():
print(i)
# 打印出 name age