dkco的个人空间 https://blog.eetop.cn/1801506 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

python_learning

已有 343 次阅读| 2023-4-11 10:33 |个人分类:python|系统分类:其他

  • 设置python版本:

method1: set python3

method2: set path = ( /xxx/xx_Tools/xxx_UTILITIES/python/Python-3.6.4 /xxx/xx_Tools/xxx_UTILITIES/python/Python-3.6.4/lib $path )

  • 查看python版本: which python

  • coding practice:

#!/usr/bin/python

import sys, re

input = sys.argv[1]

with open(input, 'r') as f:

  lines = f.readlines()

  for line in lines:

    if re.search('^\s*W\s*\(', line, re.IGNORECASE):

      p = re.search('^\s*W\s*\(\s*(.*)\s*\)', line, re.IGNORECASE)

      content = p.group(1);

      #content = p.group(1).split();

      print content

      m, n, tmp, arrtmp, arr = 0, 1, "", [], []

      for character in content:

        if re.search("\(", character):

          m+=1

          arrtmp.append(character)

        elif re.search("\)", character):

          arrtmp.append(character)

          m-=1

        else:

          arrtmp.append(character)

        

     


点赞

全部作者的其他最新日志

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 1

    关注
  • 1

    粉丝
  • 1

    好友
  • 3

    获赞
  • 1

    评论
  • 19

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-2 09:46 , Processed in 0.026822 second(s), 15 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部