Ejemplo n.º 1
0
 def top3(self):
     return (sorted(set([sanitize (each_string) for each_string in self.ath]))[0:3])
Ejemplo n.º 2
0
from sanitizedata import sanitize


try:
    with open ('julie.txt') as juldata, open('james.txt') as jamedata, open('sarah.txt') as saradata, open('mikey.txt') as mikedata:
        julie = juldata.readline()
        julie = julie.strip().split(',')
        mike = mikedata.readline()
        mike = mike.strip().split(',')
        sarah = saradata.readline()
        sarah = sarah.strip().split(',')
        james = jamedata.readline()
        james = james.strip().split(',')
except IOError as ioerr:
    print ('can\'t open files for reading: ', str(ioerr))
print (sorted([sanitize(each_string) for each_string in julie]))
print (sorted([sanitize(each_string) for each_string in mike]))
print (sorted ([sanitize(each_string) for each_string in sarah]))
print (sorted ([sanitize(each_string) for each_string in james]))


Ejemplo n.º 3
0
from sanitizedata import sanitize


def read_files(each_file):
    try:
        with open(each_file) as data:
            speeds = data.readline()
            return (speeds.strip().split(','))
    except IOError as ioerr:
        print('Can\'t open file for reading: ', str(ioerr))

james = read_files('james.txt')
mikey = read_files('mikey.txt')
sarah = read_files('sarah.txt')
julie = read_files('julie.txt')
print (sorted(set([sanitize(each_t) for each_t in james]))[0:3])
print (sorted(set([sanitize(each_t) for each_t in julie]))[0:3])
print (sorted(set([sanitize(each_t) for each_t in sarah]))[0:3])
print (sorted(set([sanitize(each_t) for each_t in mikey]))[0:3])
Ejemplo n.º 4
0
    with open('julie.txt') as julierundata, open('james.txt')  as jamesrundata, open('mikey.txt') as mikeyrundata, open('sarah.txt') as sarahrundata:
        julie_run = julierundata.readline()
        julie_run = julie_run.strip().split(',')
        james_run = jamesrundata.readline()
        james_run = james_run.strip().split(',')
        mikey_run = mikeyrundata.readline()
        mikey_run = mikey_run.strip().split(',')
        sarah_run = sarahrundata.readline()
        sarah_run = sarah_run.strip().split(',')
except IOError as ioerr:
    print('File not found: ', str(ioerr))
clean_james = []
clean_mikey = []
clean_julie = []
clean_sarah = []
for each_string in julie_run:
    clean_julie.append(sanitize(each_string))
for each_string in james_run:
    clean_james.append(sanitize(each_string))
for each_string in mikey_run:
    clean_mikey.append(sanitize(each_string))
for each_string in sarah_run:
    clean_sarah.append(sanitize(each_string))
print(sorted(clean_julie, reverse=True))
print(sorted(clean_james, reverse=True))
print(sorted(clean_mikey, reverse=True))
print(sorted(clean_sarah, reverse=True))