Hi I have a dictionary that contains data like this
dict = {'file1.txt': ['A', 'B' , 'C' , 'D' , 'E' ] , 'file2.txt': ['A', 'F' , 'C' , 'G' , 'E' ] , 'file3.txt': ['T', 'F' , 'C']}
Could some one please help me write a code that could remove the duplicate values and change the file to
dict = {'file1.txt': ['B' , 'D' ] , 'file2.txt': [ 'G' ] , 'file3.txt': [ 'T' ]}
(only the unique values...
Search Result
Collapse
13 results in 0.0044 seconds.
Keywords
Members
Tags
-
Removing duplicates from a dict
-
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")
-
How to uninstall wxpython 2.8 from Mac OSX 10.6
Some details of my machine and installed packages before proceeding further:
Mac OSX version: 10.6.6
Python version: Activestate Python 2.7.1
wxpython version: wxpython 2.8 (uses Carbon API hence limited to 32-bit mode arch only)
I installed wxPython2.8-osx-unicode-py2.7 from wxpython website using their .dmg installer file. This package uses the Carbon API and hence is limited to 32-bit mode... -
Is there a TabPageRemoved event in C#?
I am trying to trigger an event when a tab page is removed from my tabControl in C#. I have found a ControlRemoved event and implemented it but when I remove the first tab from my tabcontrol the event is not trigged. The event works for all other tabs being removed (including the tab that would not trigger the event the first time)..
Code:tabControl1.ControlRemoved +=new ControlEventHandler(tabControl1_ControlRemoved);
Code:private
-
How do I remove a shape on mouse click?
I'm trying to find out how to remove a shape on mouse click, but I can't find any solid information on how to do it. Is this possible at all? I'll be creating multiple shapes (They're the same shape, just in different locations) and I want to make it so that the user can remove individual shapes if necessary.
Can anyone please help me out with this one? -
How to delete a tab page created in one method from another method?
For example, if I want to do this
Code:private void ProcessLogin() { TabPage welcomeTab = new TabPage("Welcome"); welcomeTab.BackColor = SystemColors.Control; tabControl1.TabPages.Remove(loginTab); tabControl1.TabPages.Add(welcomeTab); }
-
How to removed selected options via Javascript?
I am new to javascript and this is all trial and error. When a user selects an option, the Id of teh option is added to a hidden form field, creating a list of id's. Each ID is displayed on the page. If you click the ID it should delete the id from the hidden form field and from view. The javascript below deletes the whole element. I have searched high and low but can not find anythning to help me remove the ID's when the user clicks the ID.
...Last edited by Niheel; Jan 26 '11, 03:39 PM. -
What is the the best and easiest way to remove elements from a list?
Hi!
I'm working on a solitaire game, with a different card deck. First I create a big list with 81 elements (cards in this case), cardList. From this list, six cards are ramdomly picked and put into another list, playerCardList, and printed on the court.
Once the cards are printed the player is asked to remove three cards. I would like these cards to be removed from cardList so they don't appear again. I would also like them... -
How to remove the recyler virus from windows 7
How do i remove $recycle bin folder from my computer? I also would like to know how i can get rid of this system volume information folder that might have the virus.
I can not view what is in the system volume information folder. And when i try to close these processes(crss. exe ,Winlogon.exe) with the task manager. It says " The operation could not be completed. Access is denied.
I also find Desktop.ini all over... -
Doing Shifts In An Array
Note: I'm using jGrasp and writing C++
I'm supposed to create a "remove" function based off of the following postcondition:
"The current item has been removed from the sequence, and the item after this (if there is one) is now the new current item."
I'm aware that one cannot simply remove an element from an array, leaving the position unoccupied, but is it possible to shift the elements in... -
remove or edit toolbar in XP
I have searched but cannot find an answer to my question. I hope I put it in the correct forum?
I use a musicplayer called Foobar in XP and I would like to change the way it looks.
On starting I want the program to open fullscreen without the toolbar or at least the X-button+minimise +maximise removed, the "ALT F4" command should still function. Preferably only with this program but if difficult I have no problem removing... -
How to remove spaces between hyperlink images??? Help?
I am creating a web page where I want several images (each is a hyperlink) to be side-by-side with no white space. I read lots of blogs on it and nothing seems to get rid of the spaces, here's where I get spaces between these pics:
<a hspace = "0" vspace = "0" style="padding: 0px;font-size:8px;font-family:verdana" href="/ChangeStatus/VACATION/"><img border="0" src="/UNSELvacation.g if"alt="ON... -
Help removing special character(s) from url variable
I am calling a variable from an aspx page (LOGON_USER) into a url and need to remove the special character "\" so the user can be logged in correctly.
I am using:
Code:<script type="text/javascript"> location.replace("http://testsite.com:1001/forms/html/testinstance.html?vsuccess=" + "<%=Request.ServerVariables["LOGON_USER"]%>","iframe1");