質問編集履歴
1
内容訂正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
オブジェクト
|
1
|
+
オブジェクトにテキストファイルの内容を入れたい
|
test
CHANGED
@@ -1,69 +1,3 @@
|
|
1
|
-
```ここに言語を入力
|
2
|
-
|
3
|
-
)kekka.py(ファイル名)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
import human as hu
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
with open("kojin.txt") as rf:
|
12
|
-
|
13
|
-
lines=rf.readlines()
|
14
|
-
|
15
|
-
for line in lines:
|
16
|
-
|
17
|
-
line = line.rstrip('\r\n')
|
18
|
-
|
19
|
-
self = hu.Human(line)
|
20
|
-
|
21
|
-
```
|
22
|
-
|
23
|
-
```ここに言語を入力
|
24
|
-
|
25
|
-
class Human:
|
26
|
-
|
27
|
-
def __init__(self,sei,mei,height,weight,seibetsu,birthday):
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
self.sei=sei
|
32
|
-
|
33
|
-
self.mei=mei
|
34
|
-
|
35
|
-
self.height=height
|
36
|
-
|
37
|
-
self.weight=weight
|
38
|
-
|
39
|
-
self.seibetsu=seibetsu
|
40
|
-
|
41
|
-
self.birthday=birthday
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
#成人しているか
|
46
|
-
|
47
|
-
def method_BirthDay(self):
|
48
|
-
|
49
|
-
#現在の年からテキスト内の年を引く処理
|
50
|
-
|
51
|
-
self.age
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
#20を超えているかどうか判定
|
56
|
-
|
57
|
-
#if(name==)
|
58
|
-
|
59
|
-
#名前出力#
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
```
|
64
|
-
|
65
|
-
2つのファイルを用意しておりテキストファイルの内容を引数として受け渡して利用したいのですがエラーが出てしまいます
|
66
|
-
|
67
1
|
```ここに言語を入力
|
68
2
|
|
69
3
|
kekka.py(ファイル名)
|