示例#1
0
def main():
    mitko = Panda('Mitko', '*****@*****.**', 'male')
    alex = Panda('Alex', '*****@*****.**', 'female')
    viki = Panda('Viki', '*****@*****.**', 'female')
    viktor = Panda('Viktor', '*****@*****.**', 'male')
    sasho = Panda('Sasho', '*****@*****.**', 'male')
    sandy = Panda('Sandy', '*****@*****.**', 'female')

    pandi = [mitko, alex, viki, viktor, sasho, sandy]

    network = PandaSocialNetwork()

    for i in pandi:
        network.add_panda(i)

    network.make_friends(mitko, alex)
    network.make_friends(viktor, alex)
    network.make_friends(viki, alex)
    network.make_friends(sasho, alex)
    network.make_friends(viki, sandy)

    network.save()

    print('\n')
    print('This is json for save {}'.format(network.print_json()))
    print('\n')

    network.load()
    network.gen_soc_network()
    print('This is soc_network {}'.format(network._soc_network))
    print('This is people {}'.format(network.people))
    print('\n')
    print('This is people2 {}'.format(network.people2))