- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
9 Posted Topics
temp=1 main_list = [['a', 'b', 'c', 'd'], ['e', 'f'], ['g', 'h']] for each_list in main_list: for ctr in range(len(each_list) - 1): temp=ctr +1 while temp < len(each_list) : print each_list[ctr],"-", each_list[temp ] temp = temp + 1;
try by adding all these option step 1: first know where is shell interpreter by type in command prompt [B][B]which bash[/B][/B] (which is command ) is show the you interpreter step 2: add #! /step 1 output at the first line step 3: after save and exit from script execute …
#!/usr/bin/env python def makebinary(number): temp=long(number) mask=1 k=0 for i in xrange(64): mask= 1 << (64 - (i+1)) k= temp & mask if k == 0: print int("0"), else: print int("1"), a='010101010101010101010101010101010101010101010101010101010101' a=int(a,2) print a #makebinary(4) makebinary(a)
example file name=a.txt tac a.txt(it will print reverse order tac is command reverse of cat)
This file name is usrinput.py #! /usr/bin/env python import sys import os This file name is allfunction.py #! /usr/bin/env python import os import string def readfile(filename): try: fd=open(filename,'r') try: for eachline in fd.readlines(): # delete all lis=string.strip(eachline) lis=lis.split() #print lis for eachword in lis: print eachword lower(eachword) #print lis[eachword] #print …
try this #!/usr/bin/env python import re def filter(file_input,file_out): fin=open(file_input,'r') fout=open(file_out,'w') for eachline in fin: #print eachline if re.match('^FF',eachline): #print eachline[2:] eachline.rstrip(" \n ") list=eachline.split(" ") print list[0],list[2],list[3] make=str(list[0])[2:] + "-- " + str(list[2]) + " -- "+ str(list[3]) #print make fout.write(make) else: #print "line=" + eachline eachline.rstrip("\n ") listano=eachline.split(" ") …
import py_compile py_compile.compile('thread.py') it will create .pyc file
I am not understand properly your problem but dynamically u can find out the list length let try this l=[1,2,3,4] i=0 for each in l: print l[i] i+=1 here value of i=no. of elements in the list
debug the code then only come to know the actual problem.I g++ complier compile the following command g++ -g -o outputfilename programname then execute gdb ./outputfilename and then execute b main then press r (4 run ) and then press s ( 4 setp by step ) for print use …
The End.
utpalendu