2020年11月7日

strftime和strptime

摘要: strftime 1 import time 2 3 4 ct = time.gmtime() 5 print("ct:\n{}".format(ct)) 6 ''' 7 ct: 8 time.struct_time(tm_year=2020, tm_mon=11, tm_mday=7, tm_ho 阅读全文

posted @ 2020-11-07 10:08 苦海舟 阅读(205) 评论(0) 推荐(0)

2020年10月28日

getattr

摘要: 1 class Persion: 2 def __init__(self, arms, head): 3 self.arms = arms 4 self.head = head 5 6 p1 = Persion(2, 1) 7 print(getattr(p1, 'arms')) 8 print(g 阅读全文

posted @ 2020-10-28 17:27 苦海舟 阅读(173) 评论(0) 推荐(0)

2020年10月23日

python-eval

摘要: #去除输入字符串的最外围的一层引号,去除后如是可执行的pyhton表达式,则之行输入结果 >>> eval('1') 1 >>> type(eval("1")) <class 'int'> >>> eval("'1'") '1' >>> type(eval("'1'")) <class 'str'> 阅读全文

posted @ 2020-10-23 13:19 苦海舟 阅读(69) 评论(0) 推荐(0)

判断python程序外部传参个数

摘要: import sys #sys.arge是一个包含外部传入参数的列表 len(sys.argv) 阅读全文

posted @ 2020-10-23 11:11 苦海舟 阅读(1908) 评论(0) 推荐(0)

2020年10月19日

ps命令-使用用进程名显示其pid

摘要: ps -C '进程名' -o pid= ps: 只显示当前用户下的进程的pid: ps x -o pid= 通过pid显示进程名: px -q 'pid' -o comm= 阅读全文

posted @ 2020-10-19 11:00 苦海舟 阅读(2430) 评论(0) 推荐(0)

2020年5月12日

sql-ROUNT函数

摘要: ROUNT 语法: ROUND(column_name,decimals) 解释: column_name 必需。需要被舍入的字段。 decimals 必需。规定要返回的小数位数。 备注: 支持四舍五入 例子: 语句: SELECT name, gdp/population FROM world 结 阅读全文

posted @ 2020-05-12 13:03 苦海舟 阅读(413) 评论(0) 推荐(0)

2019年10月9日

python不同目录间模块调用

摘要: 前置: sys.path是python的搜索模块的路径集。 以下是目录结构: 1、首先同一目录下的模块间调用:b目录下Math_3.py调用Math_4.py 2、基于第1步同级别目录下的模块调用:b目录下Math_3.py调用a目录下的Math_2.py 3、基于第2步,最外层目录math下的te 阅读全文

posted @ 2019-10-09 11:24 苦海舟 阅读(2724) 评论(0) 推荐(0)

导航