65990


以下のコードを書いて英単語テストを作ろうとしたのですが、エラーが出てしまいました。  
どうすれば解決するのでしょうか。環境はjupyter Notebook です。

**エラーメッセージ**

[code]

    AttributeError                            Traceback (most recent call last)
    <ipython-input-16-60260a1521a9> in <module>
         19     with open('英単語テスト_{:02d}.txt'.format(test_num +1),'w') as f:
         20 
    ---> 21         f.write一('第{}回英単語テスト\n\n'.format(test_num +1))
         22 
         23         for question_num in range(n_questions):
    
    AttributeError: '_io.TextIOWrapper' object has no attribute 'write一'
    
[/code]

**コード**

[code]

    # -*- coding: utf-8 -*-
    import re
    import random
    
    source = 'english_words.txt'
    
    with open(source, 'r', encoding='utf-8') as f:
        data = f.read().splitlines()
        english_words = [l.strip() for i, l in enumerate(data) if ((i%2) == 0)]
        jp_meanings = [l.strip() for i, l in enumerate(data) if ((i%2) != 0)]
    
    words_dict = dict(zip(english_words,jp_meanings))
    
    print(words_dict)
    
    n_tests = 5
    n_questions = 50
    for test_num in range(n_tests):
        with open('英単語テスト_{:02d}.txt'.format(test_num +1),'w') as f:
    
            f.write一('第{}回英単語テスト\n\n'.format(test_num +1))
    
            for question_num in range(n_questions):
                question_word = random_choice(english_words)
                correct_answer = words_dict[question_word]
    
                meanings_copy = meanings.copy()
                meanings_copy.remove(correct_answer)
                wrong_answers = random.sample(meanings_copy,3)
    
                answer_options = [correct_answer] + wrong_answers
    
                random.shuffle(answer_options)
    
                f.write('問{}. {}\n\n'.format(question_num + 1,question_word))
    
                for i in range(4):
                    f.write('{}.{}\n'.format(i + 1, answer_options[i]))
                f.write('\n\n')
    
[/code]


CC BY-SA 4.0
2020-04-26T07:28:06.183
65988
2020-04-26T07:54:50.007
2020-04-26T07:51:03.233
3060
39563
question
python
'write一 アトリビュートがない' とエラーになってしまう


> `f.write一('第{}回英単語テスト\n\n'.format(test_num +1))`

メソッド名が間違ってますね `write一`


CC BY-SA 4.0
2020-04-26T07:31:02.467
65990
2020-04-26T07:54:50.007
2020-04-26T07:54:50.007
32986
27481
65988
answer