added files
This commit is contained in:
1000
Top 1000 Words.txt
Normal file
1000
Top 1000 Words.txt
Normal file
File diff suppressed because it is too large
Load Diff
1001
Top_1000_words.csv
Normal file
1001
Top_1000_words.csv
Normal file
File diff suppressed because it is too large
Load Diff
1001
Top_1000_words_utf8.csv
Normal file
1001
Top_1000_words_utf8.csv
Normal file
File diff suppressed because it is too large
Load Diff
23
main.py
Normal file
23
main.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import csv
|
||||
|
||||
|
||||
def main():
|
||||
with open("Top 1000 Words.txt", "r", encoding="utf-8") as file:
|
||||
data = file.read().strip()
|
||||
print(data)
|
||||
print(type(data))
|
||||
splitted_string = data.split("\n");
|
||||
formated_string = []
|
||||
for line in splitted_string:
|
||||
formated_string.append(line.split(" \t"))
|
||||
print(formated_string)
|
||||
|
||||
with open("Top_1000_words.csv", "w", encoding="utf-8", newline="") as file:
|
||||
writer = csv.writer(file)
|
||||
field = ["num", "french", "english"]
|
||||
|
||||
writer.writerow(field)
|
||||
writer.writerows(formated_string)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user