Sammlung
This commit is contained in:
31
Sammlung/Praktikum/3/ias_p2_b0.1/app/stream.py
Normal file
31
Sammlung/Praktikum/3/ias_p2_b0.1/app/stream.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# coding: utf-8
|
||||
import os
|
||||
import os.path
|
||||
import codecs
|
||||
import json
|
||||
|
||||
class stream_cl(object):
|
||||
exposed = True
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def loadCharge(self, id):
|
||||
filename = str(id)
|
||||
filename += '.json'
|
||||
|
||||
file = codecs.open(os.path.join('data', filename), 'r', 'utf-8')
|
||||
charge = file.read()
|
||||
file.close()
|
||||
|
||||
return charge
|
||||
|
||||
def anzChargen(self):
|
||||
files = os.listdir('data')
|
||||
fileCounter = 0
|
||||
|
||||
for file in files:
|
||||
if file.endswith('.json'):
|
||||
fileCounter += 1
|
||||
|
||||
return fileCounter
|
Reference in New Issue
Block a user