Python3 Ctime 方法
Python3 Ctime 方法 #!/usr/bin/python3 import time print ("ctime : ", time.ctime())
阅读全文 ↗Python3 Ctime 方法 #!/usr/bin/python3 import time print ("ctime : ", time.ctime())
阅读全文 ↗Python3 时间time模块 Clock 方法 #!/usr/bin/python3 import time def procedure(): time.sleep(2.5) # measure process time t0 = time.clock() procedure() print (time.clock() - t0, "seconds process time") # measure wall time t0 = time.time() procedure() print (time.time() - t0, "seconds wall time")
阅读全文 ↗Python3 时间time模块 Asctime 方法 #!/usr/bin/python3 import time t = time.localtime() print ("asctime : ",time.asctime(t))
阅读全文 ↗Python3 时间time模块 Altzone 方法 #!/usr/bin/python3 import time print ("time.altzone : ", time.altzone)
阅读全文 ↗Python3 获得日历calendar #!/usr/bin/python3 import calendar cal = calendar.month(2016, 2) print ("Here is the calendar:") print (cal)
阅读全文 ↗Python3 格式化时间 #!/usr/bin/python3 import time localtime = time.asctime( time.localtime(time.time()) ) print ("Local current time :", localtime)
阅读全文 ↗Python3 获得当前日期 #!/usr/bin/python3 import time localtime = time.localtime(time.time()) print ("Local current time :", localtime)
阅读全文 ↗Python3 成员运算符 #!/usr/bin/python3 a = 10 b = 20 list = [1, 2, 3, 4, 5 ] if ( a in list ): print ("Line 1 - a is available in the given list") else: print ("Line 1 - a is not available in the given list") if ( b not in list ): print ("Line 2 - b is not available in the given list") else: print ("Line 2 - b is available in the given list") c=b/a if ( c in list ): print ("Line 3 - a is available in the given list") else: print ("Line 3 - a is not available in the given list")
阅读全文 ↗Python3 time模块 time 方法 #!/usr/bin/python3 import time; # This is required to include time module. ticks = time.time() print ("Number of ticks since 12:00am, January 1, 1970:", ticks)
阅读全文 ↗Python3 字典 Values 方法 #!/usr/bin/python3 dict = {'Sex': 'female', 'Age': 7, 'Name': 'Zara'} print ("Values : ", list(dict.values()))
阅读全文 ↗Python3 字典 Update 方法 #!/usr/bin/python3 dict = {'Name': 'Zara', 'Age': 7} dict2 = {'Sex': 'female' } dict.update(dict2) print ("updated dict : ", dict)
阅读全文 ↗