在 space 之前排序第一个数字
sort first numbers before the space
我向所有需要帮助的人问好,非常感谢你们
所以我有这个代码
alphabet = {
"A": 1,
"Á": 1,
"Ä": 1,
"Ă": 1,
"á": 1,
"a": 1,
"B": 2,
"b": 2,
"C": 3,
"Č": 3,
"č": 3,
"c": 3,
"D": 4,
"d": 4,
"Ď": 4,
"ď": 4,
"E": 5,
"É": 5,
"e": 5,
"é": 5,
"ě": 5,
"F": 6,
"f": 6,
"G": 7,
"g": 7,
"H": 8,
"h": 8,
"I": 9,
"i": 9,
"í": 9,
"Í": 9,
"J": 10,
"j": 10,
"k": 11,
"K": 11,
"L": 12,
"l": 12,
"M": 13,
"N": 14,
"O": 15,
"ó": 15,
"P": 16,
"Q": 17,
"R": 18,
"ř": 18,
"S": 19,
"T": 20,
"Ť": 20,
"ť": 20,
"U": 21,
"V": 22,
"W": 23,
"X": 24,
"Y": 25,
"ý": 25,
"m": 13,
"n": 14,
"ň": 14,
"o": 15,
"Ó": 15,
"p": 16,
"q": 17,
"r": 18,
"Ř": 18,
"s": 19,
"Š": 19,
"š": 19,
"t": 20,
"u": 21,
"ú": 21,
"Ú": 21,
"ů": 21,
"v": 22,
"V": 22,
"w": 23,
"x": 24,
"Ý": 25,
"y": 25,
"z": 26,
"ž": 26,
"Z": 26,
"Ž": 26,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
"0": 0,
",": 0,
".": 0,
",": 0,
":": 0,
"?": 0,
"=": 0,
"+": 0,
"-": 0,
"ˇ": 0,
"!": 0,
"„": 0,
"“": 0,
";": 0,
"»": 0,
"«": 0,
"\t": 0,
"'": 0,
"(": 0,
")": 0,
'"': 0,
'\n': 0,
"`": 0,
"´": 0,
" ": 0
}
def gematria(word):
result = 0
for char in word:
result += alphabet[char]
return result
with open('3.txt',encoding="utf8") as f:
line = f.readline()
while line:
line = f.readline()
print(gematria(line),line, file=open(""+str("66")+".txt", "a",encoding="utf8"))
with open('66.txt',encoding="utf8") as infile, open('outpu.txt', 'w') as outfile:
for line in infile:
if not line.strip(): continue
outfile.write(line)
with open("outpu.txt", "r") as f:
lines = f.readlines()
with open("yourfile.txt", "w") as f:
for line in lines:
if line.strip("\n") != "0 ":
f.write(line)
并且需要文件文件文本在图表中将数字排成一行
脚本通过打开文件工作3.text每行相似的句子
输入
11:1:2 Thank you for your help
11:1:1 and here is the text and the others continue the same lines
并且这个脚本吃掉了 da gematriie 并且需要在 gap 排序方法之前对 first came 进行排序但是我不知道该怎么做并将它保存到文件中
产出
553 11:1:1 and here is the text and the others continue the same lines
274 1:1:2 Thank you for your help
我希望它在space
之前从小到大排序
274 1:1:2 Thank you for your help
553 11:1:1 and here is the text and the others continue the same lines
读取行并计算值,然后对它们进行排序并写入文件:
def gematria(word):
# using a "generator expression"
return sum(alphabet[char] for char in word)
with open('input.txt', encoding='utf8') as f:
# A generator expression that stores a sorted tuple of
# the calculation and the stripped line.
lines = sorted((gematria(line),line.strip()) for line in f)
with open('output.txt', 'w', encoding='utf8') as f:
for num,line in lines:
# Looks like you wanted to skip blank lines
if line:
print(num, line, file=f)
我向所有需要帮助的人问好,非常感谢你们
所以我有这个代码
alphabet = {
"A": 1,
"Á": 1,
"Ä": 1,
"Ă": 1,
"á": 1,
"a": 1,
"B": 2,
"b": 2,
"C": 3,
"Č": 3,
"č": 3,
"c": 3,
"D": 4,
"d": 4,
"Ď": 4,
"ď": 4,
"E": 5,
"É": 5,
"e": 5,
"é": 5,
"ě": 5,
"F": 6,
"f": 6,
"G": 7,
"g": 7,
"H": 8,
"h": 8,
"I": 9,
"i": 9,
"í": 9,
"Í": 9,
"J": 10,
"j": 10,
"k": 11,
"K": 11,
"L": 12,
"l": 12,
"M": 13,
"N": 14,
"O": 15,
"ó": 15,
"P": 16,
"Q": 17,
"R": 18,
"ř": 18,
"S": 19,
"T": 20,
"Ť": 20,
"ť": 20,
"U": 21,
"V": 22,
"W": 23,
"X": 24,
"Y": 25,
"ý": 25,
"m": 13,
"n": 14,
"ň": 14,
"o": 15,
"Ó": 15,
"p": 16,
"q": 17,
"r": 18,
"Ř": 18,
"s": 19,
"Š": 19,
"š": 19,
"t": 20,
"u": 21,
"ú": 21,
"Ú": 21,
"ů": 21,
"v": 22,
"V": 22,
"w": 23,
"x": 24,
"Ý": 25,
"y": 25,
"z": 26,
"ž": 26,
"Z": 26,
"Ž": 26,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
"0": 0,
",": 0,
".": 0,
",": 0,
":": 0,
"?": 0,
"=": 0,
"+": 0,
"-": 0,
"ˇ": 0,
"!": 0,
"„": 0,
"“": 0,
";": 0,
"»": 0,
"«": 0,
"\t": 0,
"'": 0,
"(": 0,
")": 0,
'"': 0,
'\n': 0,
"`": 0,
"´": 0,
" ": 0
}
def gematria(word):
result = 0
for char in word:
result += alphabet[char]
return result
with open('3.txt',encoding="utf8") as f:
line = f.readline()
while line:
line = f.readline()
print(gematria(line),line, file=open(""+str("66")+".txt", "a",encoding="utf8"))
with open('66.txt',encoding="utf8") as infile, open('outpu.txt', 'w') as outfile:
for line in infile:
if not line.strip(): continue
outfile.write(line)
with open("outpu.txt", "r") as f:
lines = f.readlines()
with open("yourfile.txt", "w") as f:
for line in lines:
if line.strip("\n") != "0 ":
f.write(line)
并且需要文件文件文本在图表中将数字排成一行
脚本通过打开文件工作3.text每行相似的句子
输入
11:1:2 Thank you for your help
11:1:1 and here is the text and the others continue the same lines
并且这个脚本吃掉了 da gematriie 并且需要在 gap 排序方法之前对 first came 进行排序但是我不知道该怎么做并将它保存到文件中
产出
553 11:1:1 and here is the text and the others continue the same lines
274 1:1:2 Thank you for your help
我希望它在space
之前从小到大排序274 1:1:2 Thank you for your help
553 11:1:1 and here is the text and the others continue the same lines
读取行并计算值,然后对它们进行排序并写入文件:
def gematria(word):
# using a "generator expression"
return sum(alphabet[char] for char in word)
with open('input.txt', encoding='utf8') as f:
# A generator expression that stores a sorted tuple of
# the calculation and the stripped line.
lines = sorted((gematria(line),line.strip()) for line in f)
with open('output.txt', 'w', encoding='utf8') as f:
for num,line in lines:
# Looks like you wanted to skip blank lines
if line:
print(num, line, file=f)