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'defwords(path,path2):
words =open(path).readlines()
word_of_dictionary ={'*No*'+str(i+1)+': ':words[i]for i inrange(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()defadd_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 inzip(translation,icloud_newfile):#print(i[:]+j[:])
new_words.writelines(i+j)return new_words.close()defmy_training(path1,path2):
translation =open(path1).readlines()
icloud_newfile =open(path2).readlines()return{k: v for k,v inzip(icloud_newfile, translation)}defThe_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 =0for i in words:for j inrange(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)breakelse:
right +=1print('*=!=*','Ture', right, value)continueprint(error_words)except Exception as error2:print(error2)# 创建一个text/word文档并写入defcreate_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文档whileTrue:
string =input()file.writelines(string+'\n')if string =='exit':file.close()print('The file was closed')returnfileprint(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 =0for i in words:for j inrange(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)breakelse:
right +=1print('*=!=*','Ture',right,value)continueprint(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 inrange(times):print(i.split(' ')[-1])
value = i.split(' ')[-1]==input()
value ==Falseand(error_words.append(i),print(value,error_words))orprint('*=!=*',value)except Exception as error2:print(error2)'''
''''''''''''#持续写入''''''''''''print('input the file path:')
path =input()
file_path =open(path,'w',newline='')whileTrue:
keyboardy_input =input()if keyboardy_input =='exit!':breakelse:file.writerow(keyboardy_input)# 创建一个text/word文档并写入defcreate_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)==Trueand file1 or file2
file.write(body)ifbool(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 ] ])
'''