Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

~21.3K People Reached
Favorite Tags
Member Avatar for knan

I have a dictionary [CODE]dict1={'18':['4000','1234'],'12':['7000','4821','187','1860','123','9000']}[/CODE] I want to sort the keys and values such that, the output is, [CODE]dict1={'12':['123','187','1860','4821','7000','9000'],'18':['1234','4000']}[/CODE] I tried something! but it didn work [CODE]>>> for values in dict1: ... dict1[values].sort() ... >>> dict1 {'18': ['1234', '4000'], '12': ['123', '1860', '187', '4821', '7000', '9000']}[/CODE] Full sorting happens for …

Member Avatar for grantjenks
0
806
Member Avatar for knan

A service running in the Server is listening to port 2978 on 1xx.xxx.xx.xx for incoming connections! My PHP code receives URL data through get method. A tcp connection has to be established with the 'service' on that port and the data received from the URL should be sent to the …

Member Avatar for edwinhermann
0
282
Member Avatar for knan

<text> <p><s id="s1"><ng><w pws="yes" id="w1" p="CD">25</w> <w l="woman" pws="yes" id="w4" p="NNP" common="true" headn="yes">Woman</w></ng> <vg tense="past" voice="act" asp="simple" modal="no"><w l="create" pws="yes" id="w10" p="VBD" headv="yes">created</w></vg> <pg><w pws="yes" id="w18" p="IN">for</w></pg> <ng><w vstem="succeed" l="success" pws="yes" id="w22" p="NN" headn="yes">success</w> <w l="barbie" pws="yes" id="w30" p="NN" headn="yes">barbie</w></ng> <ng><enamex type="location"><w l="reynold" pws="yes" id="w37" p="NNP" locname="single">Reynolds</w></enamex> <w l="sep" pws="yes" …

Member Avatar for snippsat
0
221
Member Avatar for knan

Hi, I am building a simple android application that sends GPS coordinates from an Android phone to a Webserver, and the received co-ordinates are displayed one by one in the server. I think both my client and server side programs are correct, but I am not sure. Please correct the …

0
158
Member Avatar for knan

D is a list containing some words. D=[word1,word2,word3......] E is a list containing combinations of any two words in D ... E=[(word1,word2),(word7,word1)....] How can I implement the following in python: [CODE]A0[x]=1 for all x in D # This is actually Ai. when i=0, it becomes A0 B0[x]=1 for all x …

Member Avatar for Gribouillis
0
150
Member Avatar for knan

Hi can anyone tell me how to remove empty keys in the following dictionary d={'a':[],'b':['1','2'],'c':[]} I want it to be d={'b':['1','2']} I tried this. But its showing error. I know its wrong to change the size of a dictionary during iteration. But is there any other way? [CODE]>>> for x …

Member Avatar for TrustyTony
0
18K
Member Avatar for knan

We know that 0.1 + 0.1 + 0.1 - 0.3 = 0.0 But in python 0.1 + 0.1 + 0.1 - 0.3 = 5.5511151231257827e-017 Is there any way I can get 0.0...??

Member Avatar for knan
0
195
Member Avatar for knan

I have a list [CODE]x = ['abc','1','2','3','def','6','8','5','13','mcg','568','35469','6453'][/CODE] I want the output file in a dictionary as follows: [CODE]dict = {'abc':['1','2','3'],'def':['6','8','5','13'],'mcg':['568','35469','6453']}[/CODE] How can i do this?

Member Avatar for TrustyTony
0
203
Member Avatar for knan

I have dictionary with single element lists. [CODE]dictionary={'a':['A'], 'b':['B'], 'c':['C']} [/CODE] How can i change it to [CODE]{'a':'A', 'b':'B','c':'C'}[/CODE]

Member Avatar for TrustyTony
0
147
Member Avatar for knan

I dont know what goes wrong in this piece of code?!! I keep getting the following error. File "<stdin>", line 11 t1.append(list[temp]) ^ SyntaxError: invalid syntax [CODE]tl = [] for inlist in token_list: temp=[] for token in inlist: temp.append((zlib.adler32(token,65521)) tl.append(temp)[/CODE]

Member Avatar for Gribouillis
0
154
Member Avatar for knan

I have a list of lists [CODE]x=[['a', 'b', 'c', 'd'], ['e', 'f'], ['g', 'h']][/CODE] I need the following output. [CODE]a-b a-c a-d b-c b-d c-d e-f g-h[/CODE] How can i do this? Can a regular expression be used here??

Member Avatar for Gribouillis
0
149
Member Avatar for knan

I have a file named test.txt I get the file [CODE]file=open("test.txt","r") obj=file.read() file.close() print obj a=a b=b c=c d=e e=d e=f f=e f=g g=h[/CODE] All I want to do with this obj is that, I've to create a regular expression such that, 1.If the left number matches the right number, …

Member Avatar for TrustyTony
0
199
Member Avatar for knan

I have a set of text files in a folder. I want to read each file, convert the contents of the file to lowercase, remove punctuations and save them all in another directory with the same filenames. How can i do that???

Member Avatar for griswolf
0
318
Member Avatar for knan

I have 2 lists X=['a'] Y=['b','c','d','e','f'] I need to make a new list Z such that, Z = ['ab','ac','ad','ae','af'] I know this uses simple concatenation. I tried several times but without success. I am a beginner so please help me with the code. Thanks in advance.

Member Avatar for Gribouillis
0
112