Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # slop.py
- #
- # 20170225 ono
- #
- import re
- C_VALUE = 10
- j = 0
- for i in range(5):
- print('value:' + '\t' + str(C_VALUE + i))
- j += 5
- if j % 10 == 0:
- print('\t' + 'fives.')
- else:
- print('\t' + 'tens.')
- vals = ['a', 'b', 'c']
- if 'a' in vals:
- print '\'a\' is in vals.'
- print ('the 2nd is: ' + vals[2 - 1])
- print ('len of vals: ' + str(len(vals)))
- for val in vals:
- print val
- fin = open('input.txt', 'r')
- fout = open('output.txt', 'w')
- for line in fin:
- print ('input.txt: ' + line.rstrip())
- fout.write('output.txt: ' + line.rstrip() + '\n')
- fin.close()
- fout.flush()
- fout.close()
- fin = open('output.txt', 'r')
- for line in fin:
- print ('output.txt: ' + line.rstrip())
- fin.close
- reGroup = re.compile(r'^([^:]*):([^[]*)\[([^]]*)\]')
- mo = reGroup.search('time:1642[info]')
- if mo:
- print mo.group(1) + '\t' + mo.group(2) + '\t' + mo.group(3)
- reNumber = re.compile(r'[0-9]{2,}')
- for m in reNumber.findall('abcd123ef5gh6789ijkl0'):
- print m
- dic = {}
- k = 'mykey'
- v = 888
- dic[k] = dic.get(k, 0) + v
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement