Run code automatically

Souvik Dutta souvik.viksou at gmail.com
Mon Apr 20 04:40:51 EDT 2020


No no I did not tell you to do it in that way. I said you could try putting
the whole the code in the .py file in a for loop. That is:-
for a in range(10):
     <all the code in the file>

On Mon, 20 Apr, 2020, 1:55 pm hanan lamaazi, <hanan.lamaazi at gmail.com>
wrote:

> Yes, so to do it I save my code as filename.ipynb and go to terminal (cmd)
> I write the following commande:
>
> >> run for x in {1..10}; do (ipython filename.ipynb > /tmp/$x.log) & done
>
> it gives the following error:
>
> ERROR: root:File ''for.py'' not found
>
>
> I use another one:
>
> >> for filename in $(find $Foldername  -name *.py)
>     .....:do
>    .......:   python $filename
>    .......:done
>
> It gives the following error/
>
> File "<ipython-input-7-fda0e2169aa3>", line 1
>      for filename in $(find $foldername  -name *.py)
>
> SyntaxError: invalid syntax
>
>
> Could please suggest me any other solution? or what is wrong with those
> expressions?
>
> Thank you
>
>
> Le jeu. 16 avr. 2020 à 16:57, Souvik Dutta <souvik.viksou at gmail.com> a
> écrit :
>
>> Do you want to run the code many times after just clicking run once? If
>> so then I think grouping the whole program in one for loop would do the
>> task.
>>
>> Souvik python dev
>>
>> On Thu, Apr 16, 2020, 4:57 PM hanan lamaazi <hanan.lamaazi at gmail.com>
>> wrote:
>>
>>> Dear All,
>>>
>>> I just start the self learning of python, and I tried to use it in
>>> jupyter
>>> notebook. I work on real dataset and I used pandas for that. Now my
>>> problem
>>> is I developed two separate code but dependent the first one should run
>>> to
>>> give me  samples from my dataset and do the clustering (I use Kmeans) and
>>> the second should select data from each cluster provided by the first
>>> code.
>>>
>>> My question is:
>>> how can I run both code for many times without pushing the bottom "run"
>>> each time? make it automatic
>>>
>>>
>>> I tried to use Ipyparallel but seems that I don't know how to use it
>>>
>>>
>>> Thank you
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>>>
>>


More information about the Python-list mailing list