質問編集履歴
4
コードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,9 +46,9 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
-
f_in = open("
|
49
|
+
f_in = open("テキスト","r")
|
50
50
|
|
51
|
-
f_out = open("
|
51
|
+
f_out = open("テキスト2","w")
|
52
52
|
|
53
53
|
|
54
54
|
|
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
line = line.rstrip()
|
62
62
|
|
63
|
-
m = re.search("
|
63
|
+
m = re.search("特定の文字",line)
|
64
64
|
|
65
65
|
if m:
|
66
66
|
|
3
現在のコード
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,36 +34,56 @@
|
|
34
34
|
|
35
35
|
|
36
36
|
|
37
|
+
```ここに言語を入力
|
38
|
+
|
39
|
+
コード
|
40
|
+
|
41
|
+
# coding: utf-8
|
42
|
+
|
43
|
+
|
44
|
+
|
37
45
|
import re
|
38
46
|
|
39
47
|
|
40
48
|
|
41
|
-
f_in = open("
|
49
|
+
f_in = open("hairpin.fa","r")
|
42
50
|
|
43
|
-
f_out = open("
|
51
|
+
f_out = open("test5.txt","w")
|
44
52
|
|
45
53
|
|
46
54
|
|
55
|
+
cnt = 0
|
56
|
+
|
47
57
|
for line in f_in:
|
48
58
|
|
49
|
-
|
59
|
+
if cnt<=0:
|
50
60
|
|
51
|
-
|
61
|
+
line = line.rstrip()
|
52
62
|
|
53
|
-
|
63
|
+
m = re.search(">isc",line)
|
54
64
|
|
55
|
-
|
65
|
+
if m:
|
56
66
|
|
67
|
+
f_out.write(line)
|
57
68
|
|
69
|
+
f_out.write("\n")
|
58
70
|
|
59
|
-
|
71
|
+
cnt = 2
|
60
72
|
|
61
|
-
|
73
|
+
else:
|
62
74
|
|
75
|
+
f_out.write(line)
|
76
|
+
|
63
|
-
|
77
|
+
f_out.write("\n")
|
78
|
+
|
79
|
+
cnt = cnt -1
|
64
80
|
|
65
81
|
|
66
82
|
|
67
83
|
f_in.close()
|
68
84
|
|
69
85
|
f_out.close()
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
```
|
2
文章の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
-
今のところ作成したコードは
|
33
|
+
今のところ作成したコードは以下のようになってます。
|
34
34
|
|
35
35
|
|
36
36
|
|
1
今のところで、作成したコードの記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -27,3 +27,43 @@
|
|
27
27
|
|
28
28
|
|
29
29
|
ネットで調べたのですが、わかりませんでした。
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
今のところ作成したコードは
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
import re
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
f_in = open("テキストファイル","r")
|
42
|
+
|
43
|
+
f_out = open("テキストファイル2","w")
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
for line in f_in:
|
48
|
+
|
49
|
+
lines = line(1)
|
50
|
+
|
51
|
+
line = line.rstrip()
|
52
|
+
|
53
|
+
m = re.search("特定の文字",line)
|
54
|
+
|
55
|
+
if m:
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
f_out.write(line)
|
60
|
+
|
61
|
+
f_out.write(lines)
|
62
|
+
|
63
|
+
f_out.write("\n")
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
f_in.close()
|
68
|
+
|
69
|
+
f_out.close()
|