加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python 统计使用技巧

发布时间:2020-12-20 12:57:50 所属栏目:Python 来源:网络整理
导读:python 统计使用技巧 # 1、不输入回车获取值 fd = sys.stdin.fileno()old_settings = termios.tcgetattr(fd)tty.setraw(sys.stdin.fileno())ch = sys.stdin.read(1) # 值个数 termios.tcsetattr(fd,termios.TCSADRAIN,old_settings) # 2、进度条 int = 0perc

python 统计使用技巧


# 1、不输入回车获取值

fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1) # 值个数
termios.tcsetattr(fd,termios.TCSADRAIN,old_settings)

# 2、进度条

int = 0
percent = ("%s%%"%int)
sys.stdout.write("r[%-100s]%s"%("|" * int,percent))
term.write("r[%-10s]%s"%("|" * int(intt/10),percent))
sys.stdout.flush()

# 3、uid 反查

getent passwd 48
user = os.popen("getent passwd %s | awk -F‘:‘ ‘{print $1}‘"%(self.user))
process_user = user.read()

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读