Search Results

Search found 3 results on 1 pages for 'gaggina'.

Page 1/1 | 1 

  • issue in list of dict

    - by gaggina
    class MyOwnClass: # list who contains the queries queries = [] # a template dict template_query = {} template_query['name'] = 'mat' template_query['age'] = '12' obj = MyOwnClass() query = obj.template_query query['name'] = 'sam' query['age'] = '23' obj.queries.append(query) query2 = obj.template_query query2['name'] = 'dj' query2['age'] = '19' obj.queries.append(query2) print obj.queries It gives me [{'age': '19', 'name': 'dj'}, {'age': '19', 'name': 'dj'}] while I expect to have [{'age': '23' , 'name': 'sam'}, {'age': '19', 'name': 'dj'}] I thought to use a template for this list because I'm gonna to use it very often and there are some default variable who does not need to be changed. Why does doing it the template_query itself changes? I'm new to python and I'm getting pretty confused.

    Read the article

  • Mongodb querying for multiple parameters

    - by gaggina
    I've this collections { "name" : "montalto", "users" : [ { "username" : "ciccio", "email" : "aaaaaaaa", "password" : "aaaaaaaa", "money" : 0 } ], "numers" : "8", "_id" : ObjectId("5040d3fded299bf03a000002") } If I want to search for a collection with the name of montalto and a user named ciccio I'm using the following query: db.coll.find({name:'montalto', users:{username:'ciccio'}}).count() But it does not work. Where I went wrong?

    Read the article

  • how to delete lowercase words from a string in python

    - by gaggina
    I'm new in python and I'm having some issues doing a simple thing. I've an array (or list as it's said in pyton) like this: list = [ 'NICE dog' , 'blue FLOWER' , 'GOOD cat' , 'YELLOW caw'] As you see each element of this array contains some words. These words is both lowercase and uppercase. How I can delete from this array each lowercase words? For example I'd like to have as result this list: list = [ 'NICE' , 'FLOWER' , 'GOOD' , 'YELLOW']

    Read the article

1