summaryrefslogtreecommitdiff
path: root/JKTwitterBot/src/listwork.py
blob: f0b48f03f6bc3cc113d1940662235031ad1fe31b (plain)
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
#!/usr/bin/python

import pickle
import random

def shuffle(name):
    with open(name, 'rb') as f:
        tweets = pickle.load(f)

    random.shuffle(tweets)

    with open(name, 'wb') as f:
        pickle.dump(tweets, f)

def add(name, fn):
    run = True

    with open(name, 'rb') as f:
        tweets = pickle.load(f)

    with open(fn, 'r') as f:
        for line in f:
            if len(line) < 130:
                tweets.append(line.strip())

    with open(name, 'wb') as f:
        pickle.dump(tweets, f)

def test(name):
    run = True
    i = 0
    oops = []

    while run:
        line = raw_input()

        if line == '.':
            run = False

        else:
            if len(line) > 130:
                oops.append(i)

        i += 1

    print oops