On 27 February 2016 at 16:50, Ganesh Pal wrote:
> Iam on python 2.6 and Linux , I need input on the below program ,
> here is the spinet of my program
It would be much better if you presented a complete program here.
Otherwise the missing parts will confuse people. See:
http://sscce.org/
> file
On Sun, 28 Feb 2016 03:50 am, Ganesh Pal wrote:
> Iam on python 2.6 and Linux , I need input on the below program ,
> here is the spinet of my program
>
>
> filename='/tmp2/2.txt'
>
> def check_file():
> """
> Run the command parallel on all the machines , if there is a
> file named /
>>
> what is run(...)
>
The run (_ is a wrapper it uses suprocess.Popen and returns stdout
,error and extitcod e
> not a good idea to have catchall exception
how to fix this ?
>
>> > return False
>> > if __name__ == '__main__':
>> > main()
>> >
>> --
>>
> copy and paste your tr
On Sat, Feb 27, 2016 at 12:01 PM, Ganesh Pal wrote:
> changed baddr="" to file ="" in the example program , sorry for the typo
>
> > filename='/tmp2/2.txt'
> >
> > def check_file():
>
don't use global filename. just pass filename into check_file
def check_file(filename):
> > """
> > R
changed baddr="" to file ="" in the example program , sorry for the typo
> filename='/tmp2/2.txt'
>
> def check_file():
> """
> Run the command parallel on all the machines , if there is a
> file named /tmp/file2.txt extract file2.txt
>
> """
> global filename
> file = ''
>
sam wrote:
I gues: no_lines=len(list_initial)
> for j in range(0, no_lines):
range returns 0, 1, 2, ..., no_lines-1
>
> k = 0
> while k < no_lines:
> sorted_check = 0
> if list_initial[k] < list_initial[k+1]:
When j gets its last value (no_lines-1) k has the same va
gabriel,
> Now that your main problem is gone, just a few comments:
> - python lists know their length, so you don't need explicit no_lines
> and no_lines_2
> - list_initial.remove(temp_str) is fairly slow - it has to *scan* the
> list to locate temp_str. Just keep its index instead, and use del
>
At Wednesday 20/9/2006 19:39, sam wrote:
thanks again for your help. that sorted out something that had really
been bugging me.
Now that your main problem is gone, just a few comments:
- python lists know their length, so you don't need explicit no_lines
and no_lines_2
- list_initial.remove(t
"sam" <[EMAIL PROTECTED]> writes:
> hey everybody, this is my first time posting here. i'm pretty new to
> python and programming in general (as you'll soon work out for
> yourselves...)
On behalf of the entire Python community, *thank you* for putting this
disclaimer only in the body of your mes
for what it's worth. and it is approx. five times quicker than the
bubblesort i wrote to begin with on a 286-word highly unordered list,
so i wasn't wasting my time after all...
__
import time
file_input = open('wordlist.txt', 'r
yes, yes, of course, thank you. not sure what i thought i was doing
there.
i'll see if i can get it running now...
--
http://mail.python.org/mailman/listinfo/python-list
In <[EMAIL PROTECTED]>, sam wrote:
> i'm trying to code a version of a selection sort and the heart of the
> code is as follows (no_lines is simply the number of items to be
> sorted, read out of an input file):
>
> for j in range(0, no_lines):
>
> k = 0
> while k < no_lines:
> s
actually, that little bit of code i wrote is obscenely wrong anyway, so
please don't bother analyzing the flow.
any insight into the "list index out of range" error would still be
welcome, though.
--
http://mail.python.org/mailman/listinfo/python-list
13 matches
Mail list logo