Created
January 25, 2017 09:58
-
-
Save dimnikolos/399f945008351de158d9a0c9f55a3982 to your computer and use it in GitHub Desktop.
Read ScratchDataset from https://github.com/TUDelftScratchLab/ScratchDataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#A small demo of reading from | |
#https://github.com/TUDelftScratchLab/ScratchDataset | |
import csv | |
import sys | |
csv.field_size_limit(sys.maxsize) | |
with open('allBlocks.csv','r') as rawcsv: | |
reader = csv.DictReader(rawcsv,fieldnames =[ | |
'projectID', 'scriptCoordinates', 'scriptIndex', | |
'stageSpriteindication', 'spriteName', 'indentation', | |
'blockIndex', 'blockType', 'parameters']) | |
#finds and prints messages that are more | |
#than 50 characters long | |
largeMsgs = [] | |
for (i,row) in enumerate(reader): | |
if 'broadcast' in str(row['blockType']): | |
if row['parameters'] and len(row['parameters'])>50 and row['parameters'] not in largeMsgs: | |
largeMsgs.append(row['parameters']) | |
print(row['parameters']) | |
elif 'Receive' in str(row['blockType']): | |
if row['parameters'] and len(row['parameters'])>50 and row['parameters'] not in largeMsgs: | |
largeMsgs.append(row['parameters']) | |
print(row['parameters']) | |
print(len(largeMsgs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment