Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ZADANIE 2
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import sys
- import re
- counter = 0
- with open('B02.csv') as f:
- lineNumber = sum(1 for _ in f)
- with open('B02.csv') as f:
- for line in f:
- line = line.rstrip('\n')
- regLine = re.search("^(.)+;(-)*(\d)+;(-)*(\d)+;", line)
- if (regLine):
- counter = counter + 1
- if (lineNumber == counter):
- print "Csv file is valid"
- else:
- print "Csv file is not valid"
- -----------------------------------------------------------------------------------------------
- ZADANIE 4
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import sys
- import re
- file = open(sys.argv[1], 'r')
- try:
- content = file.read();
- match = re.findall(r'[\w\.-]+@[\w\.-]+', content)
- finally:
- file.close();
- print match
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement