Skip to content

Commit

Permalink
Create seq_mix_word.py
Browse files Browse the repository at this point in the history
  • Loading branch information
flystar233 authored Jun 19, 2019
1 parent 4698211 commit c19c22f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions seq_mix_word.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'''
__author__ = 'xutengfei'
__author_email__ = '[email protected]
Fuc: Compute the character with the highest frequency in the string.
'''

import sys
def max_word(in_file,out_file):

with open(in_file,'r') as IN1, open(out_file,'w') as OUT:
data = IN1.readlines()
for i in data:
text = i.upper()
OUT.write(max(text, key=text.count)+"\t"+str(text.count(max(text, key=text.count))/(len(text)-1))+"\n")
if (len(sys.argv)==3):
max_word(sys.argv[1],sys.argv[2])
else:
print("Usage: python in_file out_file")

0 comments on commit c19c22f

Please sign in to comment.