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 = ''
>
[rearranged the responses in the right order]
Costin Gamenț, 09.11.2010 11:44:
On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote:
On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote:
Costin Gamenț, 09.11.2010 10:24:
Hi, I am trying to read a string as csv, but I encountered an odd
problem.
Thank you all for your interest in my problem. As Peter pointed out,
there was one row with zero elements in it and that's where my problem
was (of course it was the very last row, hence my confidence I have
"good" data).
Have a nice one,
Costin
On Tue, Nov 9, 2010 at 12:02 PM, Nitin Pawar wrote
You may want to try a spilt if you are getting 8 different elements then it
will give you a list of those elements
On Tue, Nov 9, 2010 at 3:21 PM, Costin Gamenț wrote:
> Thank you for your timely response. Yes, I am sure "i" and "j" are
> from the same iteration. I should point out that "i" actua
Thank you for your timely response. Yes, I am sure "i" and "j" are
from the same iteration. I should point out that "i" actually has 8
elements and that str(i) gives a nice printout.
On Tue, Nov 9, 2010 at 11:33 AM, Stefan Behnel wrote:
> Costin Gamenț, 09.11.2010 10:24:
>>
>> Hi, I am trying to
Costin Gamenț wrote:
> Hi, I am trying to read a string as csv, but I encountered an odd
> problem. Here's my code:
>
> csvfile = csv.reader(datastr.split('\n'), delimiter=';')
> r = ''
> for i in csvfile:
> for j in i:
> print j
>
Costin Gamenț, 09.11.2010 10:24:
Hi, I am trying to read a string as csv, but I encountered an odd
problem. Here's my code:
csvfile = csv.reader(datastr.split('\n'), delimiter=';')
r = ''
for i in csvfile:
for j in i:
print j
On May 13, 2:39 pm, Georgy Panterov <[EMAIL PROTECTED]> wrote:
>
> def deal_hand(deck):
> HAND=[]
> for _ in range(2):
> i=random.randint(0,len(deck)) #produces a random card from the deck
^ Here i can be from 0 thru (the number of cards in the
deck).
> HAND.appen
random.randint(x,y) returns a random integer between _and including_ x and
y, so randint(0, len(deck)) might return len(deck) and since python's
indices start at 0, the maximum index is len(deck)-1.
rather than using randint(0,len(deck)-1) you could just do
card = random.choice(deck)
HAND.append
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
21 matches
Mail list logo