Search Result

Collapse
12 results in 0.0014 seconds.
Keywords
Members
Tags
dictionary
  •  

  • eminep
    started a topic to remove the items

    to remove the items

    i have the next code;


    Code:
            for y in range(0,len(lijst)):
                if lijst[y] not in dict_ls:
                    #print("lijst",lijst[y])
                    dic_verwijder[lijst[y]]=""
                    print(dic_verwijder,"verwijder dic")
                lijst_verwijder.append(dic_verwijder[y])
                print(lijst_verwijder,"verwijder")
    ...
    See more | Go to post
    Last edited by Stewart Ross; Feb 4 '12, 04:13 PM. Reason: Added code tags

  • josh wood
    started a topic Read from dictionary

    Read from dictionary

    I have a program that looks up words in a dictionary. The dictionary is in the form of a text file with one word per line. I have tried
    Code:
    If TextBox.Text.Contains(Dictionary.ReadLine()) Then 
    MsgBox("This contains a word", MsgBoxStyle.Information, "Info")
    end if
    however it only looks at the first line of the dictionary, not every line. Any ideas on how to make it read each line individually. By the way,...
    See more | Go to post

  • Need help converting a list of strings to a dictionary

    So I have a list of strings that I would like to convert to a dictionary. I want the keys in the dictionary to be the names of the strings and the... other part... i forget what its called, the part after the keys, to be how many times the string occures, this is part of a larger program so I won't submit all the code I have so far, but the list I want to convert is the following (There are a couple other lists aswell but I figure I can probably...
    See more | Go to post

  • (python) for some reason file.readline() is only reading every second line

    why is this skipping readlines in what it returns? i went through debugger and found it thinks the second line of the txt file is the first and continues to skip every second line.
    Code:
    def get_distances(filename):
        opener = open(filename)
        d = {}
        while file.readline(opener) != '':
            '''converts a file with cities and distances into a dictionary with values
            of distances from one city to
    ...
    See more | Go to post

  • Chrysie
    started a topic Python unicode conversion to UTF-8

    Python unicode conversion to UTF-8

    Hi,

    I am new to python. I am using python 2.6.6 with pyodbc-2.1.8 and pywin32-216 on Windows Vista.

    I was able to connect to MS Access with pyodbc and execute my SELECT statement to retrieve data from MS Access. However, what I have retrieved appeared to be in Unicode strings (e.g., u'xyz', etc.) which I could not use as keys to build a dictionary, and I could not use as strings to write regular expressions to match...
    See more | Go to post

  • Convert file with information into dictionary

    Hello, I have a text file with information on products, the first 3 lines can be seen below
    CODBO, Call of Duty BlackOps, 120
    SC2WL, Starcraft 2 WoL, 90
    FONV0, Fallout New Vegas 100
    CODBO is the ID, Call... is the name and 120 is the price.
    What would the code be for a function that would turn that into a dictionary that looks similarly to this:
    {'CODBO':('Call of...
    See more | Go to post

  • Steven Sargent
    started a topic What is wrong with my foreach loop?

    What is wrong with my foreach loop?

    EDIT: I figured out my problem. Thanks.
    There was no problem with my loop. The error was elsewhere in my code.
    ............... ............... ............... .
    See more | Go to post
    Last edited by Steven Sargent; Feb 24 '11, 04:13 AM. Reason: Solved problem on my own before any replies were posted

  • hoolaboola
    started a topic How to make a language dictionary in python?

    How to make a language dictionary in python?

    I want the user to be able to insert a word in english and have it returned in spanish.
    This is what I have:
    Code:
    # Two arrays, one for english words, the other for their spanish hit.
    english = [ ]
    spanish = [ ]
    
    # The words and definitions are in a file. English word first then tab and then Spanish definition on one line. Then add the words in their respective arrays.
    
    file=open("eng-span.txt",
    ...
    See more | Go to post
    Last edited by hoolaboola; Oct 21 '10, 06:32 PM. Reason: grammar

  • How to access only the key at the 0th or 1st position of the dictionary in python

    Eg. Python{ 'Good' : '0', 'Bad' :'9', 'Lazy' : '7'}
    how do i access and print only 'Good' or 'Bad' or 'Lazy'
    See more | Go to post

  • Issue in deleting session ID from Dictionary object

    Please help as this issue is driving us crazy...
    Any idea would be of great help..

    Application is running over IIS and I am getting error "
    Index was outside the bounds of the array." on the Session_Start on line
    Code:
    AllSessions[Session.SessionID] = GetSession.GetNewSession(Context);

    When I tried to catch the error I got random values for AllSessions.Cou nt. It touched 77 and after a day it...
    See more | Go to post

  • Using collections as key in Dictionary<TKey, TValue>

    Hello, I am creating a program that has a byte[] used as the key for a Dictionary class. The problem is best described with an example:

    (C# example of problem)
    Code:
            private Dictionary<byte[], string> dictionary;
    
            public void Method1()
            {
                // Set up the dictionary
                dictionary = new Dictionary<byte[], string>();
                byte[]
    ...
    See more | Go to post

  • neeru29
    started a topic How to convert a String to a Dictionary?

    How to convert a String to a Dictionary?

    I have new to python programming.

    I have sucessfully converted a dictionary into a string.
    but i want to know how can convert the string back to the dictionary.

    let us say that 'd' is dictionary

    >>>from cStringIO import StringIO
    >>> d={'a':'google' , 'b':80, 'c':'string'}
    >>> sio = StringIO()
    >>> for item in d.iteritems():
    ... sio.write('%s,...
    See more | Go to post
Working...