-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLine.py
More file actions
99 lines (80 loc) · 3.77 KB
/
Line.py
File metadata and controls
99 lines (80 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import argparse
import os
import sys
os.system('clear')
print """
////////////
/////
//// ///// ///////// //// ///////////////////
//// ///// ///////// //// ///////////////////
//// ///// //// //// //// //////
//// ///// //// //// //// //////
//// ///// //// //// //// //////////////////////
//// ///// //// //// //// //////////////////////
//// ///// //// //// //// //////
//// //////////// //// //// //// //////
//// //// //// //// ///////////////////////
/////////////////// //// /////// ///////////////////////
Author ------> Magic Man
Author's Email -----> magicmangit@gmail.com
"""
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('-L' , action = "store" , dest= 'location', required = True , help = "for you'r location's file ")
parser.add_argument('-B' , action = "store" , dest = 'Big' , type = int , required = False, help = "for biger than you'r number > ")
parser.add_argument('-S' , action = "store" , dest = 'Short' , type = int,required = False, help = "for short than you'r number <" )
parser.add_argument('-E' , action = "store" , dest = 'Equal' , type = int , required = False, help = "for equal you'r number =")
parser.add_argument('-O' , action = "store" , dest= 'output', required = True , help = "for you'r location's output ")
give_args = parser.parse_args()
location = give_args.location
Big = give_args.Big
Short = give_args.Short
Equal = give_args.Equal
out = give_args.output
try:
with open(location) as file:
line = file.read().splitlines()
except IOError:
print("Please enter you'r location's file")
sys.exit()
def equal(filename):
number = 0
for show in line:
if len(show) == Equal:
number+=1
try:
f = open(filename , 'a')
except IOError:
print("you should enter name's you'r text file in location's output")
sys.exit()
print('{} : {}' . format(number , show))
f.write(show + '\n')
def big(filename):
number = 0
for show in line:
if len(show) > Big:
number+=1
try:
f = open(filename , 'a')
except IOError:
print("you should enter name's you'r text file in location's output")
sys.exit()
print('{} : {}' . format(number , show))
f.write(show + '\n')
def short(filename):
number = 0
for show in line:
if len(show) < Short:
number+=1
try:
f = open(filename , 'a')
except IOError:
print("you should enter name's you'r text file in location's output")
sys.exit()
print('{} : {}' . format(number , show))
f.write(show + '\n')
if Equal:
equal(out)
if Big:
big(out)
if Short:
short(out)