-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_fillers.py
43 lines (34 loc) · 1.02 KB
/
check_fillers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/home/sohel/anaconda2/bin/python
# -*- coding: utf-8 -*-
# @Author: Sohel Mahmud
# @Date: 15.05.17
# @Description: Read the csv file of SHARE-EU and
# check the fillers
# The fillers are as follows:
# 1. /FLDefault[12]
# 2. [{--FLDefault[94]--}]
# 3. [{--FLLastInterviewMonthYear--}]
# 4. [{--FLChildName--}]
# 5. [{--FLCurr--}]
# 6. [{--FLLastYear--}]
# 7. [{--FLLastMonthYear--}]
# 8. [FL_HH001_1]
# 9. [Thinking of the first of these relationships, what/What/Thinking of your'+FLNumber+' marriage, what] was your partner's first name?
#10. <FL>
import csv
import re
with open('clean_SHARE_sample.csv','rb') as fh:
lines = csv.reader(fh)
lines.next()
for line in lines:
# qtext = line[3]
for cols in line:
# For String having -FL- substring
fl_words = re.findall('\S+FL\S+',cols)
print fl_words
# for [{String}] format regular expression
test1 = re.findall('.*[{[^ ]*}]',cols)
print test1
# for [{String}] format regular expression
test2 = re.findall('.*[[^ ]*]',cols)
print test2