Re: ??? POLICE AND CITY/UNIVERSITY OFFICIALS INCOMPETENCE LEADS TO 33 KILLED BY KOREAN-ALQAEDA TERRORIST ???
Blue Ridge Mountains of southwestern > Virginia, about 160 miles west of Richmond. The campus is centered > around the Drill Field, a grassy field where military cadets once > practiced. The dorm and the classroom building where the victims were > shot are on opposites sides of the Drill Field. > > Copyright 2007 Raycom Media. All rights reserved. This material may > not be published, broadcast, rewritten or redistributed. AP > contributed to this report. You mentioned "Korean Al-Qaeda Terrorist" in the title! Honesty demands that you establish it as a fact that the person was connected to Al-Qaeda and that he was a terrorist and not some mentally sick fellow. Muhammad -- http://mail.python.org/mailman/listinfo/python-list
Re: ??? POLICE AND CITY/UNIVERSITY OFFICIALS INCOMPETENCE LEADS TO 33 KILLED BY KOREAN-ALQAEDA TERRORIST ???
On Apr 17, 12:18 pm, utabintarbo <[EMAIL PROTECTED]> wrote: > On Apr 17, 10:32 am, Muhammad <[EMAIL PROTECTED]> wrote: > > > On Apr 17, 7:56 am, [EMAIL PROTECTED] wrote: > >> - > > You mentioned "Korean Al-Qaeda Terrorist" in the title! Honesty > > demands that you establish it as a fact that the person was connected > > to Al-Qaeda and that he was a terrorist and not some mentally sick > > fellow. > > Muhammad > > Just do it in a more appropriate forum, mmmkay? Sorry about that. But I only post when I feel it necessary. And I thought that if I let this person be, it might get to: But Al-Qaeda is a Muslim terrorist organization, let us go get Muslims. Precisely like Wafa Sultan and Co. who want to eradicate "Radical Islam" for a start, but end up saying "There is no moderate Muslim". In other words, "Get all the Muslims". Not that it frightens me, I have seen much worse, but it is a bother. Muhammad -- http://mail.python.org/mailman/listinfo/python-list
[UDEMY] complete python course 13 hour long course
link as follow: https://www.udemy.com/complete-package-of-python-course-mastery-in-python-course/?couponCode=PYTHONFORUM -- https://mail.python.org/mailman/listinfo/python-list
PyQt4
Hi, How can we confirm that either PyQt4 is already installed on LInux machine or not? Please suggest commands to confirm the already existence of PyQt4 in the machine. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Plot/Graph
Hi, Could anybody tell me that how can I plot graphs by matplotlib and get expertise in a short time? I have to plot 2D plots just like origin software. Secondly, how could we draw some horizontal reference line at zero when the vertical scale is from -3 to 3? Looking for your posts, please. Thank you. p.s: Is there any short and to the point text book/manual/pdf to learn 2D plotting with matplotlib? -- https://mail.python.org/mailman/listinfo/python-list
Re: PyQt4
On Sunday, April 3, 2016 at 12:15:06 PM UTC-7, Michael Torrie wrote: > On 04/03/2016 12:57 PM, Muhammad Ali wrote: > > > > Hi, > > > > How can we confirm that either PyQt4 is already installed on LInux machine > > or not? > > > > Please suggest commands to confirm the already existence of PyQt4 in the > > machine. > > Ideally you make a distribution-specific package of the binary in a .deb > on Debian or an RPM on other distros, and specify that it depends on the > package that provides PyQt4. That way when it's installed, modern > package managers will automatically install the dependencies. > > Alternatively you can use try and except in your python code to attempt > to import something from PyQt4 and see if it fails or not. This > technique is also used to make your code work either PyQt4 or PySide, > depending on which the user has installed. > > try: > from PySide import QtGui > except ImportError: > from PyQt4 import QtGui > > If neither are installed, this little example will end with an ImportError. Thank you for your suggestions. I tried both but it shows the following error: IndentationError: expected an indented block Actually, I have to plot some graphs by using matplotlib and PyQt4 at supercomputer. Any other suggestion??? -- https://mail.python.org/mailman/listinfo/python-list
Re: Plot/Graph
On Sunday, April 3, 2016 at 2:04:45 PM UTC-7, Michael Selik wrote: > Indeed there is. Every example in the gallery shows the code to produce it. > > http://matplotlib.org/gallery.html > > On Sun, Apr 3, 2016, 8:05 PM Muhammad Ali > wrote: > > > > > Hi, > > > > Could anybody tell me that how can I plot graphs by matplotlib and get > > expertise in a short time? I have to plot 2D plots just like origin > > software. > > > > Secondly, how could we draw some horizontal reference line at zero when > > the vertical scale is from -3 to 3? > > > > Looking for your posts, please. > > > > Thank you. > > > > p.s: Is there any short and to the point text book/manual/pdf to learn 2D > > plotting with matplotlib? > > -- > > https://mail.python.org/mailman/listinfo/python-list > > Thank you for your post. How do I convert/change/modify python script so that my data could be extracted according to python script and at the end it generates another single extracted data file instead of displaying/showing some graph? So that, I can manually plot the newly generated file (after data extraction) by some other software like origin. -- https://mail.python.org/mailman/listinfo/python-list
Re: Plot/Graph
On Sunday, April 3, 2016 at 2:35:58 PM UTC-7, Oscar Benjamin wrote: > On 3 Apr 2016 22:21, "Muhammad Ali" wrote: > > > > How do I convert/change/modify python script so that my data could be > extracted according to python script and at the end it generates another > single extracted data file instead of displaying/showing some graph? So > that, I can manually plot the newly generated file (after data extraction) > by some other software like origin. > > It depends what you're computing and what format origin expects the data to > be in. Presumably it can use CSV files so take a look at the CSV module > which can write these. > > (You'll get better answers to a question like this if you show us some code > and ask a specific question about how to change it.) > > -- > Oscar How could the python script be modified to generate data file rather than display a plot by using matplotlib? def make_plot(plot): indent = plot.plot_options.indent args = plot.plot_options.args # Creating the plot print ('Generating the plot...') fig = plt.figure(figsize=(plot.fig_width_inches,plot.fig_height_inches)) ax = fig.add_subplot(111) # Defining the color schemes. print (indent + '>>> Using the "' + plot.cmap_name + '" colormap.') if(plot.plot_options.using_default_cmap and not args.running_from_GUI): print (2 * indent + 'Tip: You can try different colormaps by either:') print (2 * indent + ' * Running the plot tool with the option -icmap n, ' \ 'with n in the range from 0 to', len(plot.plot_options.cmaps) - 1) print (2 * indent + ' * Running the plot tool with the option "-cmap cmap_name".') print (2 * indent + '> Take a look at') print (4 * indent + '<http://matplotlib.org/examples/color/colormaps_reference.html>') print (2 * indent + ' for a list of colormaps, or run') print (4 * indent + '"./plot_unfolded_EBS_BandUP.py --help".') # Building the countour plot from the read data # Defining the (ki,Ej) grid. if(args.interpolation is not None): ki = np.linspace(plot.kmin, plot.kmax, 2 * len(set(plot.KptsCoords)) + 1, endpoint=True) Ei = np.arange(plot.emin, plot.emax + plot.dE_for_hist2d, plot.dE_for_hist2d) # Interpolating grid_freq = griddata((plot.KptsCoords, plot.energies), plot.delta_Ns, (ki[None,:], Ei[:,None]), method=args.interpolation, fill_value=0.0) else: ki = np.unique(np.clip(plot.KptsCoords, plot.kmin, plot.kmax)) Ei = np.unique(np.clip(plot.energies, plot.emin, plot.emax)) grid_freq = griddata((plot.KptsCoords, plot.energies), plot.delta_Ns, (ki[None,:], Ei[:,None]), method='nearest', fill_value=0.0) if(not args.skip_grid_freq_clip): grid_freq = grid_freq.clip(0.0) # Values smaller than zero are just noise. # Normalizing and building the countour plot manually_normalize_colorbar_min_and_maxval = False if((args.maxval_for_colorbar is not None) or (args.minval_for_colorbar is not None)): manually_normalize_colorbar_min_and_maxval = True args.disable_auto_round_vmin_and_vmax = True maxval_for_colorbar = args.maxval_for_colorbar minval_for_colorbar = args.minval_for_colorbar else: if not args.disable_auto_round_vmin_and_vmax: minval_for_colorbar = float(round(np.min(grid_freq))) maxval_for_colorbar = float(round(np.max(grid_freq))) args.round_cb = 0 if(manually_normalize_colorbar_min_and_maxval or not args.disable_auto_round_vmin_and_vmax): modified_vmin_or_vmax = False if not args.disable_auto_round_vmin_and_vmax and not args.running_from_GUI: print (plot.indent + '* Automatically renormalizing color scale '\ '(you can disable this with the option --disable_auto_round_vmin_and_vmax):') if manually_normalize_colorbar_min_and_maxval: print (plot.indent + '* Manually renormalizing color scale') if(minval_for_colorbar is not None): previous_vmin = np.min(grid_freq) if(abs(previous_vmin - minval_for_colorbar) >= 0.1): modified_vmin_or_vmax = True print (2 * indent + 'Previous vmin = %.1f, new vmin = %.1f' % (previous_vmin, minval_for_colorbar)) else: minval_for_colorbar = np.min(grid_freq) if(maxval_for_colorbar is not None): previous_vmax = np.max(grid_freq) if(abs(previous_vmax
Re: Plot/Graph
On Sunday, April 3, 2016 at 5:19:15 PM UTC-7, MRAB wrote: > On 2016-04-04 01:04, Muhammad Ali wrote: > > On Sunday, April 3, 2016 at 2:35:58 PM UTC-7, Oscar Benjamin wrote: > >> On 3 Apr 2016 22:21, "Muhammad Ali" wrote: > >> > > >> > How do I convert/change/modify python script so that my data could be > >> extracted according to python script and at the end it generates another > >> single extracted data file instead of displaying/showing some graph? So > >> that, I can manually plot the newly generated file (after data extraction) > >> by some other software like origin. > >> > >> It depends what you're computing and what format origin expects the data to > >> be in. Presumably it can use CSV files so take a look at the CSV module > >> which can write these. > >> > >> (You'll get better answers to a question like this if you show us some code > >> and ask a specific question about how to change it.) > >> > >> -- > >> Oscar > > > > How could the python script be modified to generate data file rather than > > display a plot by using matplotlib? > > > > > > def make_plot(plot): > > indent = plot.plot_options.indent > > args = plot.plot_options.args > > # Creating the plot > > print ('Generating the plot...') > > fig = > > plt.figure(figsize=(plot.fig_width_inches,plot.fig_height_inches)) > > ax = fig.add_subplot(111) > > # Defining the color schemes. > > print (indent + '>>> Using the "' + plot.cmap_name + '" colormap.') > > if(plot.plot_options.using_default_cmap and not args.running_from_GUI): > > print (2 * indent + 'Tip: You can try different colormaps by > > either:') > > print (2 * indent + ' * Running the plot tool with the option > > -icmap n, ' \ > > 'with n in the range from 0 to', > > len(plot.plot_options.cmaps) - 1) > > print (2 * indent + ' * Running the plot tool with the option > > "-cmap cmap_name".') > > print (2 * indent + '> Take a look at') > > print (4 * indent + > > '<http://matplotlib.org/examples/color/colormaps_reference.html>') > > print (2 * indent + ' for a list of colormaps, or run') > > print (4 * indent + '"./plot_unfolded_EBS_BandUP.py --help".') > > > > # Building the countour plot from the read data > > # Defining the (ki,Ej) grid. > > if(args.interpolation is not None): > > ki = np.linspace(plot.kmin, plot.kmax, 2 * > > len(set(plot.KptsCoords)) + 1, endpoint=True) > > Ei = np.arange(plot.emin, plot.emax + plot.dE_for_hist2d, > > plot.dE_for_hist2d) > > # Interpolating > > grid_freq = griddata((plot.KptsCoords, plot.energies), > > plot.delta_Ns, (ki[None,:], Ei[:,None]), > > method=args.interpolation, fill_value=0.0) > > else: > > ki = np.unique(np.clip(plot.KptsCoords, plot.kmin, plot.kmax)) > > Ei = np.unique(np.clip(plot.energies, plot.emin, plot.emax)) > > grid_freq = griddata((plot.KptsCoords, plot.energies), > > plot.delta_Ns, (ki[None,:], Ei[:,None]), > > method='nearest', fill_value=0.0) > > > > if(not args.skip_grid_freq_clip): > > grid_freq = grid_freq.clip(0.0) # Values smaller than zero are > > just noise. > > # Normalizing and building the countour plot > > manually_normalize_colorbar_min_and_maxval = False > > if((args.maxval_for_colorbar is not None) or (args.minval_for_colorbar > > is not None)): > > manually_normalize_colorbar_min_and_maxval = True > > args.disable_auto_round_vmin_and_vmax = True > > maxval_for_colorbar = args.maxval_for_colorbar > > minval_for_colorbar = args.minval_for_colorbar > > else: > > if not args.disable_auto_round_vmin_and_vmax: > > minval_for_colorbar = float(round(np.min(grid_freq))) > > maxval_for_colorbar = float(round(np.max(grid_freq))) > > args.round_cb = 0 > > if(manually_normalize_colorbar_min_and_maxval or not > > args.disable_auto_round_vmin_and_vmax): > > modified_vmin_or_vmax =
Re: Plot/Graph
On Sunday, April 3, 2016 at 2:35:58 PM UTC-7, Oscar Benjamin wrote: > On 3 Apr 2016 22:21, "Muhammad Ali" wrote: > > > > How do I convert/change/modify python script so that my data could be > extracted according to python script and at the end it generates another > single extracted data file instead of displaying/showing some graph? So > that, I can manually plot the newly generated file (after data extraction) > by some other software like origin. > > It depends what you're computing and what format origin expects the data to > be in. Presumably it can use CSV files so take a look at the CSV module > which can write these. > > (You'll get better answers to a question like this if you show us some code > and ask a specific question about how to change it.) > > -- > Oscar Yes, it is complete script and it works well with matplotlib. -- https://mail.python.org/mailman/listinfo/python-list
Re: Plot/Graph
On Tuesday, April 5, 2016 at 8:16:22 AM UTC+8, Muhammad Ali wrote: > On Sunday, April 3, 2016 at 2:35:58 PM UTC-7, Oscar Benjamin wrote: > > On 3 Apr 2016 22:21, "Muhammad Ali" wrote: > > > > > > How do I convert/change/modify python script so that my data could be > > extracted according to python script and at the end it generates another > > single extracted data file instead of displaying/showing some graph? So > > that, I can manually plot the newly generated file (after data extraction) > > by some other software like origin. > > > > It depends what you're computing and what format origin expects the data to > > be in. Presumably it can use CSV files so take a look at the CSV module > > which can write these. > > > > (You'll get better answers to a question like this if you show us some code > > and ask a specific question about how to change it.) > > > > -- > > Oscar > > Yes, it is complete script and it works well with matplotlib. But I have to modify it to extract data into a single .dat file instead of directly plotting it by using matplotlib. I want to plot the data file in some other software. -- https://mail.python.org/mailman/listinfo/python-list
python script for .dat file
Hello, Could any body tell me a general python script to generate .dat file after the extraction of data from more than 2 files, say file A and file B? Or could any body tell me the python commands to generate .dat file after the extraction of data from two or more than two files? I have to modify some python code. Looking for your valuable posts. Thank you. Ali -- https://mail.python.org/mailman/listinfo/python-list
Re: python script for .dat file
On Tuesday, April 5, 2016 at 8:30:27 AM UTC-7, Joel Goldstick wrote: > On Tue, Apr 5, 2016 at 11:23 AM, Muhammad Ali > wrote: > > > > Hello, > > > > Could any body tell me a general python script to generate .dat file after > > the extraction of data from more than 2 files, say file A and file B? > > > > Or could any body tell me the python commands to generate .dat file after > > the extraction of data from two or more than two files? > > > > I have to modify some python code. > > > > Looking for your valuable posts. > > > > Thank you. > > > > Ali > > -- > > https://mail.python.org/mailman/listinfo/python-list > > What exactly is a .dat file? and how is it different from any other > file? Is it binary or text data? > > > -- > Joel Goldstick > http://joelgoldstick.com/blog > http://cc-baseballstats.info/stats/birthdays It is text data. -- https://mail.python.org/mailman/listinfo/python-list
Re: python script for .dat file
On Tuesday, April 5, 2016 at 9:07:54 AM UTC-7, Oscar Benjamin wrote: > On 5 April 2016 at 16:44, Muhammad Ali wrote: > > On Tuesday, April 5, 2016 at 8:30:27 AM UTC-7, Joel Goldstick wrote: > >> On Tue, Apr 5, 2016 at 11:23 AM, Muhammad Ali > >> wrote: > >> > > >> > Could any body tell me a general python script to generate .dat file > >> > after the extraction of data from more than 2 files, say file A and file > >> > B? > >> > > >> > Or could any body tell me the python commands to generate .dat file > >> > after the extraction of data from two or more than two files? > >> > > >> > I have to modify some python code. > >> > >> What exactly is a .dat file? and how is it different from any other > >> file? Is it binary or text data? > > > > It is text data. > > You haven't provided enough information for someone to answer your > question. This is a text mailing list so if a .dat file is text then > you can paste here an example of what it would look like. What would > be in your input files and what would be in your output files? What > code have you already written? > > If the file is large then don't paste its entire content here. Just > show an example of what the data would look like if it were a smaller > file (maybe just show the first few lines of the file). > > Probably what you want to do is easily achieved with basic Python > commands so I would recommend to have a look at a tutorial. There are > some listed here: > https://wiki.python.org/moin/BeginnersGuide/NonProgrammers > > Also the tutor mailing list is probably more appropriate for this > level of question: > https://mail.python.org/mailman/listinfo/tutor > > -- > Oscar Input and outout files are text files. e.g: #KptCoord #E-E_Fermi #delta_N 0. -22. 0.000E+00 0.0707 -22. 0.000E+00 0.1415 -22. 0.000E+00 0.2122 -22. 0.000E+00 0.2830 -22. 0.000E+00 0.3537 -22. 0.000E+00 0.4245 -22. 0.000E+00 0.4952 -22. 0.000E+00 0.5660 -22. 0.000E+00 0.6367 -22. 0.000E+00 0.7075 -22. 0.000E+00 0.7782 -22. 0.000E+00 0.8490 -22. 0.000E+00 0.9197 -22. 0.000E+00 0.9905 -22. 0.000E+00 -- https://mail.python.org/mailman/listinfo/python-list
Re: python script for .dat file
On Tuesday, April 5, 2016 at 2:24:02 PM UTC-7, Joel Goldstick wrote: > On Tue, Apr 5, 2016 at 4:47 PM, Mark Lawrence via Python-list > wrote: > > On 05/04/2016 21:35, Michael Selik wrote: > >> > >> What code have you written so far? > >> > > > > Would you please not top post on this list, it drives me nuts!!! > > > > > A short drive? ;) > > -- > Joel Goldstick > http://joelgoldstick.com/blog > http://cc-baseballstats.info/stats/birthdays Would any one paste here some reference/sample python code for such extraction of data into text file? -- https://mail.python.org/mailman/listinfo/python-list
Self Learning Fortran Programming
Hello, I am interested in Python programming, however, it will be my first serious attempt towards coding/simulation/programming. My back ground is Physics, no practical experience with programming languages. So, this post is for the valuable suggestions from the experts that how can I start self learning Python from scratch to advanced level in minimum time. For this, please recommend Python version, literature, text books, websites, video lectures, your personnel tips, etc. In addition, you may also add some extra suggestions for shell script writing as well. You may recommend for both Linux and Windows operating systems. Looking for your posts. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Self Learning Fortran Programming
I don't know how to change the title now, but I am looking for python. -- https://mail.python.org/mailman/listinfo/python-list
Python on Windows with linux environment
Hi, I use windows regularly, however, I use linux for only my research work at supercomputer. In my research field (materials science) most of the scripts are being written in python with linux based system. Could I installed such linux based python on my window 7? So that I can use those linux based scripts written in python and I can also write my own scripts/code without entirely changing my operating system from windows to linux. Looking for your valuable suggestions. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python on Windows with linux environment
On Friday, June 3, 2016 at 6:27:50 AM UTC+8, Eric S. Johansson wrote: > On 6/2/2016 2:03 PM, Joel Goldstick wrote: > > Although the OP is using Windows 7, according to recent articles, > > Ubuntu is teaming with MS for Windows 10 to include a bash shell, > > presumably with the package management of Ubuntu (debian), with pip > > goodness and virtualenv and virtualenvwrapper. That route should make > > W10 and linux (ubuntu) nearly identical environments to deal with > > had forgotten about that. it should be released end of july and I am > looking forward to the update! in the meantime, I'm suffering with > cygwin :-) Please send me the link through which I can get regular updates about this new release. -- https://mail.python.org/mailman/listinfo/python-list
how to match list members in py3.x
for each word in each line how can we check to see if a word is already present in a list and if it is not how to append that word to a new list -- https://mail.python.org/mailman/listinfo/python-list
Re: how to match list members in py3.x
IF YOU CAN'T HELP BETTER IGNORE THE POST AND DON'T TRY TO BE A SMART ASS. -- https://mail.python.org/mailman/listinfo/python-list
Re: how to match list members in py3.x
Thank you -- https://mail.python.org/mailman/listinfo/python-list
Re: how to match list members in py3.x
On Sunday, 25 November 2018 11:41:56 UTC-5, Joel Goldstick wrote: > On Sun, Nov 25, 2018 at 11:36 AM Muhammad Rizwan > <> wrote: > > > > IF YOU CAN'T HELP BETTER IGNORE THE POST AND DON'T TRY TO BE A SMART ASS. > > > > > > -- > > https://mail.python.org/mailman/listinfo/python-list > > That isn't a productive way to get assistance. It is true that > people here are often very knowledgeable to help with python problems, > but as a rule, doing someone's homework isn't something people like > to do. > > On to your problem. You should understand lists and sets, and for > loops. Try some code and come back with what you have. Then you will > get help to go further > > -- > Joel Goldstick > http://joelgoldstick.com/blog > http://cc-baseballstats.info/stats/birthdays I have been trying since morning but it doesn't work. -- https://mail.python.org/mailman/listinfo/python-list
Re: how to match list members in py3.x
On Sunday, 25 November 2018 10:59:46 UTC-5, Alister wrote: > On Sun, 25 Nov 2018 07:43:42 -0800, Muhammad Rizwan wrote: > > > for each word in each line how can we check to see if a word is already > > present in a list and if it is not how to append that word to a new list > > the 1st step is to stay awake in class & listen to your instructor, then > try to apply the principle involved > > We don't do homework for you > > when you have produced a program of you own (not necessarily working) if > you post it here then we will be more than happy to provide constructive > criticism > > > > > -- > "Show business is just like high school, except you get paid." > - Martin Mull IF YOU CAN'T HELP BETTER IGNORE THE POST AND DON'T TRY TO BE A SMART ASS. -- https://mail.python.org/mailman/listinfo/python-list
Re: how to match list members in py3.x
On Sunday, 25 November 2018 12:14:37 UTC-5, Joel Goldstick wrote: > On Sun, Nov 25, 2018 at 11:51 AM Muhammad Rizwan > <> wrote: > > > > On Sunday, 25 November 2018 11:41:56 UTC-5, Joel Goldstick wrote: > > > On Sun, Nov 25, 2018 at 11:36 AM Muhammad Rizwan > > > <> wrote: > > > > > > > > IF YOU CAN'T HELP BETTER IGNORE THE POST AND DON'T TRY TO BE A SMART > > > > ASS. > > > > > > > > > > > > -- > > > > https://mail.python.org/mailman/listinfo/python-list > > > > > > That isn't a productive way to get assistance. It is true that > > > people here are often very knowledgeable to help with python problems, > > > but as a rule, doing someone's homework isn't something people like > > > to do. > > > > > > On to your problem. You should understand lists and sets, and for > > > loops. Try some code and come back with what you have. Then you will > > > get help to go further > > > > > > -- > > > Joel Goldstick > > > http://joelgoldstick.com/blog > > > http://cc-baseballstats.info/stats/birthdays > > > > I have been trying since morning but it doesn't work. > > The way to use this mailing list is to explain your problem, which you > have done. Then, show the code you have written with the results it > produces. Its good to include the operating system you are using > (windows, linux, osx), and if your code produces a traceback, copy and > paste it here. > > Its common to be frustrated learning to write and writing code, but if > you want help you have to show something for others to help you with > > -- > > https://mail.python.org/mailman/listinfo/python-list > > > > -- > Joel Goldstick > http://joelgoldstick.com/blog > http://cc-baseballstats.info/stats/birthdays Below is my approach which I am sure is wrong somewhere and it doesn't work the way expected, the append doesn't do anything in my code nor does it returns any traceback all i see is a empty list printed at the end, I am using win10 x64 python 3.x atom-editor. Please take a look if you can tell me what am I doing wrong here. I want to check each list word by word if the word is not repeated in the same list it should be appended to a 'newlist'. Thanks in advance handle = open('file.txt') newlist = list() for line in handle: #line.rstrip() linewords = line.split() print(linewords) for word in linewords: newlist.append(word) if word not in linewords: continue print('new: ',newlist) -- https://mail.python.org/mailman/listinfo/python-list
Re: how to match list members in py3.x
On Sunday, 25 November 2018 13:48:42 UTC-5, Alister wrote: > On Sun, 25 Nov 2018 08:49:03 -0800, Muhammad Rizwan wrote: > > > On Sunday, 25 November 2018 10:59:46 UTC-5, Alister wrote: > >> On Sun, 25 Nov 2018 07:43:42 -0800, Muhammad Rizwan wrote: > >> > >> > for each word in each line how can we check to see if a word is > >> > already present in a list and if it is not how to append that word to > >> > a new list > >> > >> the 1st step is to stay awake in class & listen to your instructor, > >> then try to apply the principle involved > >> > >> We don't do homework for you > >> > >> when you have produced a program of you own (not necessarily working) > >> if you post it here then we will be more than happy to provide > >> constructive criticism > >> > >> > >> > >> > >> -- > >> "Show business is just like high school, except you get paid." > >> - Martin Mull > > > > IF YOU CAN'T HELP BETTER IGNORE THE POST AND DON'T TRY TO BE A SMART > > ASS. > > with an attitude like that I will go one better & ignore ALL your posts > > > > -- > Good news. Ten weeks from Friday will be a pretty good day. Yes please ignore. Don't need any help from you either. -- https://mail.python.org/mailman/listinfo/python-list
Which Version Of Python Is Best To Install Now..
Sent from [1]Mail for Windows 10 I Want To Reinstall Python Now Which Version I Install Now References Visible links 1. https://go.microsoft.com/fwlink/?LinkId=550986 -- https://mail.python.org/mailman/listinfo/python-list
Consume an iterable
In the python help for itertools, the following function is provided: def consume(iterator, n): "Advance the iterator n-steps ahead. If n is none, consume entirely." collections.deque(islice(iterator, n), maxlen=0) What is the advantage of using a collections.deque against, say, the following code? def consume(iterator, n): for _ in islice(iterator, n): pass Regards, Muhammad Alkarouri -- http://mail.python.org/mailman/listinfo/python-list
Re: Consume an iterable
Thanks everyone, but not on my machine (Python 2.6.1, OS X 10.6) it's not: In [1]: from itertools import count, islice In [2]: from collections import deque In [3]: i1=count() In [4]: def consume1(iterator, n): ...: deque(islice(iterator, n), maxlen=0) ...: ...: In [5]: i2=count() In [6]: def consume2(iterator, n): ...: for _ in islice(iterator, n): pass ...: ...: In [7]: timeit consume1(i1, 10) 100 loops, best of 3: 1.63 us per loop In [8]: timeit consume2(i2, 10) 100 loops, best of 3: 846 ns per loop Can somebody please test whether it is only my machine or is this reproducible? (Thanks Jan for making me actually carry the test) -- http://mail.python.org/mailman/listinfo/python-list
Re: Consume an iterable
On 23 Jan, 12:45, Peter Otten <__pete...@web.de> wrote: > Muhammad Alkarouri wrote: > > Thanks everyone, but not on my machine (Python 2.6.1, OS X 10.6) it's > > not: > > > In [1]: from itertools import count, islice > > > In [2]: from collections import deque > > > In [3]: i1=count() > > > In [4]: def consume1(iterator, n): > > ...: deque(islice(iterator, n), maxlen=0) > > ...: > > ...: > > > In [5]: i2=count() > > > In [6]: def consume2(iterator, n): > > ...: for _ in islice(iterator, n): pass > > ...: > > ...: > > > In [7]: timeit consume1(i1, 10) > > 100 loops, best of 3: 1.63 us per loop > > > In [8]: timeit consume2(i2, 10) > > 100 loops, best of 3: 846 ns per loop > > > Can somebody please test whether it is only my machine or is this > > reproducible? > > I can reproduce it. The deque-based approach has a bigger constant overhead > but better per-item performance. Its asymptotical behaviour is therefore > better. > > $ python consume_timeit.py > consume_deque > 10: 1.77500414848 > 100: 3.7001137 > 1000: 24.7235469818 > > consume_forloop > 10: 1.22008490562 > 100: 5.86271500587 > 1000: 52.2449371815 > > consume_islice > 10: 0.897439956665 > 100: 1.51542806625 > 1000: 7.70061397552 > > $ cat consume_timeit.py > from collections import deque > from itertools import islice, repeat > > def consume_deque(n, items): > deque(islice(items, n), maxlen=0) > > def consume_forloop(n, items): > for _ in islice(items, n): > pass > > def consume_islice(n, items): > next(islice(items, n-1, None), None) > > def check(fs): > for consume in fs: > items = iter(range(10)) > consume(3, items) > rest = list(items) > assert rest == range(3, 10), consume.__name__ > > if __name__ == "__main__": > fs = consume_deque, consume_forloop, consume_islice > check(fs) > > items = repeat(None) > > from timeit import Timer > for consume in fs: > print consume.__name__ > for n in (10, 100, 1000): > print "%6d:" % n, > print Timer("consume(%s, items)" % n, > "from __main__ import consume, items").timeit() > print > $ > > With next(islice(...), None) I seem to have found a variant that beats both > competitors. > > Peter Thanks Peter, I got more or less the same result on my machine (Python 2.6.1, x86_64, OS X 10.6): ~/tmp> python consume_timeit.py consume_deque 10: 1.3138859272 100: 3.54495286942 1000: 24.9603481293 consume_forloop 10: 0.658113002777 100: 2.85697007179 1000: 24.6610429287 consume_islice 10: 0.637741088867 100: 1.09042882919 1000: 5.44473600388 The next function performs much better. It is also much more direct for the purposes of consume and much more understandable (at least for me) as it doesn't require a specialized data structure which is subsequently not used as such. I am thus inclined to report it as a python documentation enhancement (bug) request. Any comments? Cheers, Muhammad -- http://mail.python.org/mailman/listinfo/python-list
Re: Consume an iterable
On 23 Jan, 13:32, Peter Otten <__pete...@web.de> wrote: > Muhammad Alkarouri wrote: > > The next function performs much better. It is also much more direct > > for the purposes of consume and much more understandable (at least for > > me) as it doesn't require a specialized data structure which is > > subsequently not used as such. > > I am thus inclined to report it as a python documentation enhancement > > (bug) request. Any comments? > > I would support that as a the deque(..., maxlen=0) trick is a bit too clever > for my taste. > > Peter > > PS: Remember to include the bug fix for n=0 if you proceed. Done. http://bugs.python.org/issue7764 Thanks for all the effort. Muhammad -- http://mail.python.org/mailman/listinfo/python-list
Re: Consume an iterable
On 23 Jan, 13:46, Peter Otten <__pete...@web.de> wrote: > Peter Otten wrote: > > Duncan Booth wrote: > > >> Peter Otten <__pete...@web.de> wrote: > > >>> With next(islice(...), None) I seem to have found a variant that beats > >>> both competitors. > > >> It has different behaviour for n==0 but I'm sure that's easily fixed. > > > "Different behaviour" being a euphemism for broken ;) > > > def consume_islice(n, items): > > if n == 0: > > return > > next(islice(items, n-1, None), None) > > Even better: > > def consume_islice(n, items): > next(islice(items, n, n), None) > > Peter I submitted the bug report before considering this alternative, which is better. I may add this later in the day, but I have to wait a little as it seems you are going to optimize/improve the function almost out of existence:) If you are happy with this one, and can add the comment on the issue (http://bugs.python.org/issue7764) yourself, please do so. What I can say is, I am definitely very happy that I asked the question. You live and learn:) Cheers, Muhammad -- http://mail.python.org/mailman/listinfo/python-list
Is __mul__ sufficient for operator '*'?
Hi everyone, I was having a go at a simple implementation of Maybe in Python when I stumbled on a case where x.__mul__(y) is defined while x*y is not. The class defining x is: class Maybe(object): def __init__(self, obj): self.o = obj def __repr__(self): return 'Maybe(%s)' % object.__getattribute__(self, "o") def __getattribute__(self, name): try: o = object.__getattribute__(self, "o") r = getattr(o,name) if callable(r): f = lambda *x:Maybe(r(*x)) return f else: return Maybe(r) except: return Maybe(None) The code exercising this class is: >>> x=Maybe(9) >>> x.__mul__(7) Maybe(63) >>> x*7 Traceback (most recent call last): File "", line 1, in x*7 TypeError: unsupported operand type(s) for *: 'Maybe' and 'int' The farthest I can go in this is that I presume that __mul__ (as called by operator *) is supposed to be a bound method while I am returning a lambda function. Is this correct? And How can I make the implementation support such operators? Cheers, Muhammad Alkarouri -- http://mail.python.org/mailman/listinfo/python-list
Function attributes
Hi everyone, What is the simplest way to access the attributes of a function from inside it, other than using its explicit name? In a function like f below: def f(*args): f.args = args print args is there any other way? I am guessing the next question will be: should I really care? It just feels like there should be a way, but I am not able to verbalise a valid one at the moment, sorry. Regards, Muhammad Alkarouri -- http://mail.python.org/mailman/listinfo/python-list
Re: Few questions on SOAP
Your question is borderline if not out of topic in this group. I will make a few comments though. On Feb 18, 3:36 pm, joy99 wrote: > Dear Group, > > I was reading on SOA or Service Oriented Architecture for last few > days and got some questions. As this is a room for the expert computer > scientists, if you can help me solve my queries. > > As per I read and felt SOA is an architecture, which relies on few > basic principles as, > the system must be modular, the modules must be distributive, module > interfaces must be clearly defined and documented, module that > implements a service can be swapped out for another module that offers > the same service and interface, service provider modules must be > shareable. > SOA is an architecture which is now a days governed like XML by W3C. SOA is an architecture which can be implemented using any of a number of different middleware choices. It is not governed or controlled by anyone. You are mixing it up with SOAP, which is a web services technology, currently governed by W3C. For example, I tend to use SOA implemented using REST (Representational State Transfer). All of these technologies are somewhat explained in wikipedia. You probably want to start there. > The latest version is SOAP 1.2. This is the latest of SOAP, not SOA. > SOA is implemented mainly in a client/server environment, where > applications have the use of service, thus we can say it is a service- > oriented architecture. > It is a step towards cloud computing with its sister WSDL and BPM. A SOAP web service is described using WSDL. BPM is not really connected with them, but is probably more connected with SOA as an architecture. BPM can be implemented using SOAP/WSDL web services, as can SOA. > > If both client/server are following the SOA then they can communicate > and exchange information without worrying for platform. You mean SOAP here. In real life, there are interoperability issues. So various implementations of SOAP will need a bit of work to actually work together. SOA is an architecture and does not help exchanging information in a direct way. > > SOAP is a software implementation of Python,.NET,J2EE based on this > principle. SOAP is a web services protocol that was created before the concept of SOA was developed enough for use and is largely independent of it. SOAP has been implemented in many different languages, like Java, .Net, C/C++, Python, etc. > SOAPPy is a Python implementation. SOAP implementations in Python are not of the best quality (in my opinion, there are better ways to achieve the ends needed). SOAPpy is currently a bit out of date. The better ones are ZSI (for client and server) and suds (for clients). I guess I have already answered some of your questions. > > My questions are: > (i) Am I understanding correctly? See above. > (ii) Does SOAP has any standard architecture like UML other than the > W3C one? Depends on what you mean by architecture. SOAP is a standard. UML is a way of modelling software and can be used to model web services, which can then be implemented in SOAP. > (iii) Can I write short programs to check the SOAP using my personal > computer as client as well as Server? Yes. Try ZSI examples (http://pywebsvcs.sourceforge.net/zsi.html). > (iv) Is SOAPpy fine? See above. > (v) What is the difference among SOAP, WSDL and BPM. SOAP standardise the communication between client and server. WSDL describes the methods provided by a server to be consumed by a client (interfaces in Java language). BPM is a management method to improve business and is not a software protocol but an approach. > (vi) As SOAP is for communication with a server if I pick a URL and > start to communicate with Google/Yahoo would they allow? To be able to talk SOAP to a server, it must understand SOAP. Some of those companies do provide SOAP web service access, but their standard search pages are accessible in pure HTTP (the way you browser uses them). To access a SOAP service you need to know the functions exported by it, which are usually defined in a WSDL document. > (vii) Can I design a web based robot/crawler with SOAP? No. Web pages are accessed using simple HTTP. SOAP is usually deployed on top of HTTP, but most web pages are not communicated using SOAP. You can search for Python web crawling; there are a lot of examples on the web. Regards, k -- http://mail.python.org/mailman/listinfo/python-list
Re: Few questions on SOAP
Thanks every one for commenting. I guess I misspoke. I meant to say that the group is not necessarily the best for parts of this question, so Subhabrata might not get as enthusiastic responses as in some other lists (which i don't recollect at the moment, sorry). I didn't want to convey the sense that his question is not welcome, rather that it might not get a lot of answers. Thanks Brendon and Steve for the support, and thanks Mark for correcting my slip. Regards, k -- http://mail.python.org/mailman/listinfo/python-list
Byte Offsets of Tokens, Ngrams and Sentences?
Hi, Does any one know how to tokenize a string in python that returns the byte offsets and tokens? Moreover, the sentence splitter that returns the sentences and byte offsets? Finally n-grams returned with byte offsets. Input: This is a string. Output: This 0 is 5 a 8 string. 10 thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Byte Offsets of Tokens, Ngrams and Sentences?
On Aug 6, 10:49 am, "Gabriel Genellina" wrote: > En Fri, 06 Aug 2010 06:07:32 -0300, Muhammad Adeel > escribió: > > > Does any one know how to tokenize a string in python that returns the > > byte offsets and tokens? Moreover, the sentence splitter that returns > > the sentences and byte offsets? Finally n-grams returned with byte > > offsets. > > > Input: > > This is a string. > > > Output: > > This 0 > > is 5 > > a 8 > > string. 10 > > Like this? > > py> import re > py> s = "This is a string." > py> for g in re.finditer("\S+", s): > ... print g.group(), g.start() > ... > This 0 > is 5 > a 8 > string. 10 > > -- > Gabriel Genellina Hi, Thanks. Can you please tell me how to do for n-grams and sentences as well? -- http://mail.python.org/mailman/listinfo/python-list
Smith-Waterman Algorithm in Python
Hi, Does any one about any implementation of classical Smith Waterman local alignment algorithm and it's variants for aligning natural language text? thanks -- http://mail.python.org/mailman/listinfo/python-list
New Windows Mobile Smartphones from I-mate
Windows Mobile smart phone device manufacturer, i-mate has shown off its latest models -the Ultimate 9502 and the Ultimate 8502.for other details http://infomobilepk.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: How to get final URL after redirection
Not visible to me, can you tell me please? On Sun, Apr 27, 2014 at 8:55 PM, Joel Goldstick wrote: > Huh? His email is in his post > On Apr 27, 2014 11:45 AM, wrote: > >> Hi Nsihant, I need your help, can I get your email address? >> -- >> https://mail.python.org/mailman/listinfo/python-list >> > -- https://mail.python.org/mailman/listinfo/python-list
Python based silent installer, how to?
Hi All, I'm using many python based packages (ex. bzr-2.4.1-1.win32-py2.6.exe) inside my installer. How can I install them silently in Windows? PS Most installers has arguments for silent installation ex. NSIS based installers has /S argument but I didn't find any reference for python based installers -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net <>-- http://mail.python.org/mailman/listinfo/python-list
Re: Python based silent installer, how to?
On 20/10/2011 01:35 ص, Alec Taylor wrote: Just download the msi (script is available to regenerate yourself) and run it with the silent swtich, something like: msiexec /x nameofmsi.msi Sorry I didn't explain what I'm looking for exactly. I've packages built by bdist_wininst, Is there any way for install them silently? Or is there any way for convert them to another format (ex. msi) in that way I can install them silently. -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net <>-- http://mail.python.org/mailman/listinfo/python-list
Re: Python based silent installer, how to?
On 20/10/2011 12:00 ص, Steven D'Aprano wrote: Please don't send raw HTML (so-called "rich text") to mailing lists. It makes it very difficult for some people to read. If you must use HTML, please ensure your email client or news reader also sends a plain text version of the message as well. Sorry I forgot to configure my Thunderbird. That will depend on what your installer is, and whether it has an option for silent installation. Your question is unclear. What is the connection between Python and the installer? "I am installing Python on Windows." "Python is already installed, and I'm installing extra Python packages, using many different installers." "I'm installing applications using an installer written in Python." "I'm writing my own installer, using Python." or something else? If you want a better answer, you will need to explain what you are doing in more detail. I've packages built by bdist_wininst, Is there any way for install them silently? Or is there any way for convert them to another format (ex. msi) in that way I can install them silently. PS I tried to unzip that packages (I thought I may re-package un-zipped packages by NSIS or something else) and I discovered that the structure of directories of bdist_wininst packages so different! for example: ---xlwt-0.7.2.win32.exe--- PURELIB | |-- xlwt-0.7.2-py2.5.egg-info |-+ xlwt |-+ doc |-+ examples |-- __init__.py |-- antlr.py . . ---bzr-2.3.4-1.win32-py2.6.exe--- DATA |-- Doc PLATLIB | |-- bzr-2.3.4-py2.6.egg-info |-+ bzrlib |-+ bundle |-+ doc |-- __init__.py |-- _annotator_py.py . . SCRIPTS | |-- bzr |-- bzr-win32-bdist-postinstall.py -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net <>-- http://mail.python.org/mailman/listinfo/python-list
Re: Python based silent installer, how to?
On 20/10/2011 12:12 م, Tim Golden wrote: If you can get the source (specifically including the setup.py which I don't think is included in the wininst .zip) then you can use that to build an msi: python setup.py bdist_msi which you can then manage via the usual msiexec switches. It's often available from the same source as the wininst .exe and/or from the project's code repository. In case I got .egg file (ex. http://pypi.python.org/pypi/setuptools/0.6c11) from some website, can I use it as alternative to bdist_wininst package? In case 'yes' where I've to put .egg file? -- Best Regards Muhammad Bashir Al-Noimi My Blog: http://mbnoimi.net <>-- http://mail.python.org/mailman/listinfo/python-list