英语学习

mac_book_pro = '/Users/deleter/Downloads/word_for_learning_English/word_for_learing_English.txt'
mac_book_pro_newfile = '/Users/deleter/Downloads/word_for_learning_English/New_word_for_learing_English.txt'
mac_book_pro_transation = '/Users/deleter/Downloads/word_for_learning_English/translation.txt'
mac_book_pro_words_and_translation = '/Users/deleter/Downloads/word_for_learning_English/words_and_translation.txt'

icloud = '/Users/deleter/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/word_for_learning_English/word_for_learing_English.txt'
icloud = '/Users/deleter/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/word_for_learning_English/word_for_learing_English2.txt'
icloud_newfile = '/Users/deleter/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/word_for_learning_English/New_word_for_learing_English.txt'
translation = '/Users/deleter/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/word_for_learning_English/translation.txt'
words_and_translation = '/Users/deleter/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/word_for_learning_English/words_and_translation.txt'

def words(path,path2):
    words = open(path).readlines()
    word_of_dictionary = {'*No*'+ str(i+1)+': ':words[i] for i in range(len(words))}
    new_words=open(path2,'w',newline='')
    for v in word_of_dictionary.items():
        print(v)
        new_words.writelines(v)
    return new_words.close()


def add_file(path1,path2,path3):
    translation = open(path1).readlines()
    icloud_newfile = open(path2).readlines()
    new_words = open(path3, 'w', newline='')
    #translation_for_words = [icloud_newfile[i] + '------' + translation[i] for i in range(len(translation))]
    for i,j in zip(translation,icloud_newfile):
        #print(i[:]+j[:])
        new_words.writelines(i+j)
    return new_words.close()

def my_training(path1,path2):
    translation = open(path1).readlines()
    icloud_newfile = open(path2).readlines()
    return {k: v for k,v in zip(icloud_newfile, translation)}


def The_words_training():
    import re
    print('please inputing the words path now :')
    the_word_path = input()
    print('Please enter repetition times/words:')
    times = int(input())
    try:
        read_text = str(open(the_word_path).readlines()).lower()
    except Exception as error:
        print(error)
    try:
        print('Ok,let\'s go go go !!!!! ')
        words = re.sub(r'[\'[\\n\]]', '', read_text).split(',')
        error_words = []
        right = 0
        for i in words:
            for j in range(times):
                the_words = i.split(' ')[-1]
                print(the_words)
                k = input()
                value = the_words == k
                if value == False:
                    error_words.append(i)
                    print(value, error_words)
                    break
                else:
                    right += 1
                    print('*=!=*', 'Ture', right, value)
                    continue
        print(error_words)
    except Exception as error2:
        print(error2)


# 创建一个text/word文档并写入
def create_an_txt_file():
    import time
    print('Enter the file path and fiel name :')
    file_path , name = input() , input()
    # 文件路径,名称,内容必须识字符串
    file = open(file_path + name + time.strftime('%Y-%m-%d', time.localtime()) + '.txt', 'w')  # 也可以创建一个.doc的word文档
    while True:
        string = input()
        file.writelines(string+'\n')
        if string == 'exit':
            file.close()
            print('The file was closed')
            return file

print(create_an_txt_file())




print('运行请输入:\'macbook\'以输入进macbook\n建议直接回车以保存云端')
runing = str(input()) == 'macbook' and words(mac_book_pro,mac_book_pro_newfile) or words(icloud,icloud_newfile)
runing2 = str(input()) == 'macbook' and add_file(mac_book_pro_newfile,mac_book_pro_transation,mac_book_pro_words_and_translation) or add_file(icloud_newfile,translation,words_and_translation)
#runing3 = my_training(icloud_newfile,translation)

print(runing,'run1 it\'s ok')
print(runing2)
#print(runing3)


''''
''''''''''''''''''''''''''''''''''''''
import re

print('please inputing the words path now :')
the_word_path = input()
print('Please enter repetition times/words:')
times = int(input())
try:
    read_text = str(open(the_word_path).readlines()).lower()
except Exception as error:
    print(error)
try:
    print('Ok,let\'s go go go !!!!! ')
    words = re.sub(r'[\'[\\n\]]','',read_text).split(',')
    error_words = []
    right = 0
    for i in words:
        for j in range(times):
            the_words = i.split(' ')[-1]
            print(the_words)
            k = input()
            value = the_words==k
            if value == False:
                error_words.append(i)
                print(value,error_words)
                break
            else:
                right += 1
                print('*=!=*','Ture',right,value)
                continue
    print(error_words)
except Exception as error2:
    print(error2)

'''





'''
import re
print('please inputing the words path now :')
the_word_path = input()
print('Please enter repetition times/words:')
times = int(input())
try:
    read_text = str(open(the_word_path).readlines()).lower()
except Exception as error:
    print(error)
try:
    print('Ok,let\'s go go go !!!!! ')
    words = re.sub(r'[\'[\\n\]]','',read_text).split(',')
    error_words = []
    for i in words:
        for j in range(times):
            print(i.split(' ')[-1])
            value = i.split(' ')[-1]==input()
            value == False and (error_words.append(i),print(value,error_words)) or print('*=!=*',value)
except Exception as error2:
    print(error2)
'''
''''''''''''#持续写入''''''''''''
print('input the file path:')
path = input()
file_path = open(path,'w',newline='')
while True:
    keyboardy_input = input()
    if keyboardy_input == 'exit!':
        break
    else:
        file.writerow(keyboardy_input)


# 创建一个text/word文档并写入
def create_an_txt_file(name, body, file_path, change_the_format_vlaue):
    # 文件路径,名称,内容必须识字符串
    file1 = open(file_path + name + time.strftime('%Y-%m-%d', time.localtime()) + '.txt', 'w')  # 也可以创建一个.doc的word文档
    file2 = open(file_path + name + time.strftime('%Y-%m-%d', time.localtime()) + '.doc', 'w')
    file = bool(change_the_format_vlaue) == True and file1 or file2
    file.write(body)
    if bool(change_the_format_vlaue) == True:
        print('file name : ', file)
        file.close()
    else:
        return



'''
    #the_source_file_path = [i.split(' ') for i in open(source_file).read().splitlines() if len(i) > 0]
'
    the_source_file_path = open('/Users/deleter/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/word_for_learning_English/word_note/body1/elixir_ Basic_types .txt').read().split('\xa0')
    [i.split(' ') for i in the_source_file_path]


the_source_file_path = open('/Users/deleter/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/word_for_learning_English/word_note/body1/elixir_ Basic_types .txt').read().splitlines()
kkk = []
for i in the_source_file_path:
    for words in re.sub(r'[# – “ ”`\'\[\]/,> _ . = " + - <):}?"{(]',' ',i).split(' '):
        kkk.append(words)
        for word in kkk.split(' ') :
            if len(word) > 0:
                print(word[0])
print(kkk)
the_source_file_path = open('/Users/deleter/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3/Documents/word_for_learning_English/word_note/body1/elixir_ Basic_types .txt').read().splitlines()
kkk = []
end = []
for i in the_source_file_path:
    for words in re.sub(r' hex [# \\n– \\\“ ”`\'\[\]/,> _ . = " + - <):}?"{(]',' ',i).split(' '):
        if len(words) > 1:
            kkk.append(words)
for s in  kkk:
    x = re.sub(r' hex [# \\n– \\\“ ”`\'\[\]/,> _ . = " + - <):}?"{(]', ' ', s)
    print(x)


''.join([str(j) for j in [re.sub(r'[# – “ ”`\'\[\]/,> _ . = " + - <):}?"{(]',' ',i).split(' ') for i in the_source_file_path if len(i) > 0 ] ])
'''

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值