[Tutor] Search for Text in File

2019-08-15 Thread Stephen P. Molnar
TypeError: 'str' object is not callable'. Assistance will be much appreciated. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set http://www.Molecular-Modeling.net Multivariate and stochastic 614.312.7528 (c) Skype: smolnar1 ___

Re: [Tutor] Two Scripts, Same Commands, One Works, One Doesn't

2019-05-16 Thread Stephen P. Molnar
cated one. On Wed, May 15, 2019 at 08:16:02AM -0400, Stephen P. Molnar wrote: I am writing scripts to semi-automate some of my Quantum Chemistry software and have encountered a problem that has me baffled. The two scripts have the same form, the only difference being the commands. One script works

[Tutor] Two Scripts, Same Commands, One Works, One Doesn't

2019-05-15 Thread Stephen P. Molnar
# -*- coding: utf-8 -*- """ calc_pdbqt Created on Mon May 13 09:50:54 2019 copyrignt (c) 2019 Stephen P. Molnar, Ph.D. All rights reserved """ import subprocess with open('ligand') as infile: ligand = infile.read().strip().split() for nv

[Tutor] Problem with Saved File

2019-04-07 Thread Stephen P. Molnar
when I import the saved file into QtiPlot it is a line vector. What am I missing in the savetxt statement? Thanks in advance -- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.netStochastic and multivariate (614)312-7528(c) Skype: smolnar1

[Tutor] Problem with Saved File

2019-04-05 Thread Stephen P. Molnar
when I import the saved file into QtiPlot it is a line vector. What am I missing in the savetxt statement? Thanks in advance -- Stephen P. Molnar, Ph.D. Life is a fuzzy set www.molecular-modeling.netStochastic and multivariate (614)312-7528(c) Skype: smolnar1

Re: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid'

2017-11-20 Thread Stephen P. Molnar
On 11/20/2017 10:18 AM, Steven D'Aprano wrote: On Mon, Nov 20, 2017 at 08:18:41AM -0500, Stephen P. Molnar wrote: I'm not really looking for someone to do the programming for me. I know that the code works, because it did and produced the attached plot. I just don't know

Re: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid'

2017-11-20 Thread Stephen P. Molnar
On 11/20/2017 09:34 AM, William Ray Wing wrote: On Nov 19, 2017, at 3:14 PM, Stephen P. Molnar mailto:s.mol...@sbcglobal.net>> wrote: On 11/19/2017 03:10 PM, William Ray Wing wrote: On Nov 19, 2017, at 11:36 AM, Stephen P. Molnar mailto:s.mol...@sbcglobal.net>> wrote: I ha

Re: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid'

2017-11-20 Thread Stephen P. Molnar
orking. Actually, all of my programming experience has been with FORTRAN, starting with II in 1961 (yes, I am rather an old... an Organic Chemist. Let's start over, This is the code: #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Multiple_Plots_2_b.py Copyright

Re: [Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid'

2017-11-19 Thread Stephen P. Molnar
On 11/19/2017 03:10 PM, William Ray Wing wrote: On Nov 19, 2017, at 11:36 AM, Stephen P. Molnar wrote: I have written a short Python 3 script to plot three curves (one plot) of data from a FORTRAN program. Initially the code worked and produced the plot which is attached. I have also

[Tutor] AttributeError: 'BezierPath' object has no attribute '_draw_solid'

2017-11-19 Thread Stephen P. Molnar
oblem (or problens) might be and would greatly appreciate a pointer towards the solution. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 0.1

Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread Flynn, Stephen (L & P - IT)
Yep - oracle for example has hundreds of tables which hold metadata. for example (this will look terrible due to the length of it but if you assume it's 3 lines; a title line, some underlining for each column and the data itself): SQL> select * from all_tables where owner = 'FLYNNS' and table

[Tutor] Problem with Plot Legend

2017-06-13 Thread Stephen P. Molnar
the solution, but I'm beginning to think that I don't know just what the question that I should be asking, hence no results. A pointer towards thech solution to this problem will be much appreciated. Thanks in advance. -- Stephen P. Molnar, Ph.D. Consultant www.molecular-modeling.net (614)312-7528 (c) Skype: smolnar1 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Coming from R, what's a good IDE editor? I've tried PyCharm and Spyder

2017-06-05 Thread Stephen P. Molnar
rg/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor Here's how I start Spyder, in Xfce: /home/comp/Apps/anaconda3/bin/spyder -- Stephen P. Molnar, Ph.D.

Re: [Tutor] Pyuthon 3 Combine 1 D Arrays

2017-05-18 Thread Stephen P. Molnar
]]) In [16]: np.hstack((a1,a2)).T Out[16]: array([[ 0.09042866, 0.63008665, 0.99106757], [ 0.99965848, 0.12334957, 0.43502637]]) Hope this helps! ze On 05/17/2017 08:50 PM, Stephen P. Molnar wrote: I'm beginning to think that I don't know how to ask the question as Google

[Tutor] Pyuthon 3 Combine 1 D Arrays

2017-05-17 Thread Stephen P. Molnar
a n by 300 array where n is the number of single column arrays. I have tried zip, np.concatenate etc with only failure. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype

Re: [Tutor] Subtract a 1D Array from a 2D Array

2017-05-13 Thread Stephen P. Molnar
On 05/13/2017 11:16 AM, eryk sun wrote: On Sat, May 13, 2017 at 1:33 PM, Stephen P. Molnar wrote: I am using Python 3.6 in Anaconda3 Spyder IDE. I have two arrays: X Y Z a 0 0 0 2.059801 0

[Tutor] Subtract a 1D Array from a 2D Array

2017-05-13 Thread Stephen P. Molnar
error message: ValueError: operands could not be broadcast together with shapes (3,5) (1,3) My search for a solution has not been successful. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype

Re: [Tutor] python 3 np.savetxt(name_s, I_z) produces IndexError: tuple index out of range

2017-05-11 Thread Stephen P. Molnar
On 05/11/2017 02:26 PM, Stephen P. Molnar wrote: 0 down vote favorite I am using Spyder3.1.4 with Python 3.6.0 | Anaconda 4.3.0 (64-bit) | and IPython 6.0.0. My script is rather long and calculates a series of molecular indices using the same formula and a series of different coefficients

[Tutor] python 3 np.savetxt(name_s, I_z) produces IndexError: tuple index out of range

2017-05-11 Thread Stephen P. Molnar
# -*- coding: utf-8 -*- """ Created on Sat Apr 8 15:17:07 2017 @author: comp Copyright (c) 2017 Stephen P. Molnar, Ph.D. """ import matplotlib.pyplot as plt import numpy as np start=1 finish=31 points=300 s = np.linspace(start, finish, points) np.savetxt('s&#

Re: [Tutor] Index Out of Range?List

2017-05-04 Thread Stephen P. Molnar
On 05/03/2017 08:51 PM, Alan Gauld via Tutor wrote: On 04/05/17 00:32, Stephen P. Molnar wrote: import numpy as np name = input("Enter Molecule ID: ") name = str(name) You don't need the str(), input always returns a string. name_in =name[:]+'.lac.dat' And you

Re: [Tutor] Index Out of Range?List

2017-05-04 Thread Stephen P. Molnar
On 05/03/2017 08:32 PM, Steven D'Aprano wrote: On Wed, May 03, 2017 at 07:32:53PM -0400, Stephen P. Molnar wrote: [...] When it is run I get: IndexError: list index out of range That alone is useless to us. Please post the full traceback, starting from the line Traceback (most r

[Tutor] Index Out of Range?List

2017-05-03 Thread Stephen P. Molnar
ion is how do I extract just one line of this file? Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 ___ Tutor maill

Re: [Tutor] Python 3.6 Extract Floating Point Data from a Text File

2017-04-30 Thread Stephen P. Molnar
On 04/30/2017 02:02 PM, Steven D'Aprano wrote: On Sun, Apr 30, 2017 at 06:09:12AM -0400, Stephen P. Molnar wrote: [...] I would have managed to extract input data from another calculation (not a Python program) into the following text file. LOEWDIN ATOMIC CH

[Tutor] Python 3.6 Extract Floating Point Data from a Text File

2017-04-30 Thread Stephen P. Molnar
. Googling the problem has not resulted on any insight as to the solution, and any help will be much appreciated. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1

Re: [Tutor] Python 3.6 Multiply the elements of a 2D Array by the elements of a 1D Aeeay

2017-04-17 Thread Stephen P. Molnar
On 04/16/2017 04:57 PM, Sergio Rojas wrote: On 04/14/2017 04:21 AM, Peter Otten wrote: Stephen P. Molnar wrote: However, what I want to do is multiply each element ob D by each element of s and sum all of the products. If you *really* want this: sum_of_all_products = s.sum() * D.sum

Re: [Tutor] Python 3.6 Multiply the elements of a 2D Array by the elements of a 1D Aeeay

2017-04-14 Thread Stephen P. Molnar
On 04/14/2017 01:11 PM, Alan Gauld via Tutor wrote: On 14/04/17 13:41, Stephen P. Molnar wrote: The equation that I a want to evaluate (the one that I programmed in FORTRAN) is equation (7) in the attached scan of one of the pages of Stephen P. Molnar and James W. King, Theory and

Re: [Tutor] Python 3.6 Multiply the elements of a 2D Array by the elements of a 1D Aeeay

2017-04-14 Thread Stephen P. Molnar
On 04/14/2017 04:21 AM, Peter Otten wrote: Stephen P. Molnar wrote: However, what I want to do is multiply each element ob D by each element of s and sum all of the products. If you *really* want this: sum_of_all_products = s.sum() * D.sum() example: s = [a b c] D = [[a1 a2] [a3 a4

[Tutor] Python 3.6 Multiply the elements of a 2D Array by the elements of a 1D Aeeay

2017-04-13 Thread Stephen P. Molnar
will be much appreciated. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Euclidean Distances between Atoms in a Molecule.

2017-04-03 Thread Stephen P. Molnar
On 04/03/2017 05:36 AM, Peter Otten wrote: Stephen P. Molnar wrote: I am trying to port a program that I wrote in FORTRAN twenty years ago into Python 3 and am having a hard time trying to calculate the Euclidean distance between each atom in the molecule and every other atom in the molecule

[Tutor] Euclidean Distances between Atoms in a Molecule.

2017-04-02 Thread Stephen P. Molnar
appreciate any pointers towards a solution. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1 ___ Tutor maillist - Tutor

Re: [Tutor] Extract Block of Data from a 2D Array

2017-03-31 Thread Stephen P. Molnar
On 03/31/2017 10:50 AM, Peter Otten wrote: Stephen P. Molnar wrote: I have a block of data extracted from a quantum mechanical calculation: CARTESIAN COORDINATES (A.U.) NO LB ZAFRAG MASS X Y Z 0 C 6.0

Re: [Tutor] Extract Block of Data from a 2D Array

2017-03-31 Thread Stephen P. Molnar
On 03/31/2017 10:29 AM, Alan Gauld via Tutor wrote: On 31/03/17 13:19, Stephen P. Molnar wrote: I have a block of data extracted from a quantum mechanical calculation: How is this data stored? On paper? In a database? In XML? A CSV file? Plain text? The answer to that will go a long way to

[Tutor] Extract Block of Data from a 2D Array

2017-03-31 Thread Stephen P. Molnar
have only succeeded in increasing my mental entropy. Help will be much appreciated. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1

Re: [Tutor] Spyder IDE Anaconda3: Problem with Plt.savefig

2017-03-02 Thread Stephen P. Molnar
On 03/01/2017 08:32 PM, Alan Gauld via Tutor wrote: On 01/03/17 20:20, Stephen P. Molnar wrote: I have written a Python3 program to plot and save UV/VIS spectra from the results of an Orca quantum mechanical calculation. Caveat: This forum is for help on the core Python language and its

[Tutor] Spyder IDE Anaconda3: Problem with Plt.savefig

2017-03-01 Thread Stephen P. Molnar
m doing wrong. It's probably a red-faced forehead slapper of a mistake on my part. A point in the right direction to properly naming the saved figure will be muck appreciated. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modeling.net

Re: [Tutor] Problem with Spyder IDE in Anaconda3

2017-02-27 Thread Stephen P. Molnar
On 02/27/2017 02:29 PM, Marc Tompkins wrote: On Mon, Feb 27, 2017 at 10:46 AM, Stephen P. Molnar mailto:s.mol...@sbcglobal.net>> wrote: I had sent the following message to Anaconda Support: I have just installed anaconda3-4.3.0 and upgraded Spyder to v-3.1.3. When I open

[Tutor] Problem with Spyder IDE in Anaconda3

2017-02-27 Thread Stephen P. Molnar
on to this problem. Nothing I found about the Kaspersky product told me where (or how) to find an exclusion list. I'm hoping that kind sole on this list can help em solve this problem. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.molecular-modelin

[Tutor] Incorporate an Integer as part of a Label

2017-01-14 Thread S. P. Molnar
27;.csv', 'w') as f: where is the integer molefule number designator that is the only input for the calculation. Thanks in advance. -- Stephen P. Molnar, Ph.D.Life is a fuzzy set www.Molecular-Modeling.net Stochastic and multivariate (614)312-7528 (c) Skype: smolnar1

Re: [Tutor] Help with a Conversion

2017-01-05 Thread S. P. Molnar
On 01/05/2017 01:10 PM, Peter Otten wrote: S. P. Molnar wrote: I have just started attempting programming in Python and am using Spyder with Python 3.5.2 on a Linux platform. (I first started programing in Fortran II using punched paper tape. Yes, am a rather elderly . . .). I have bumbled

Re: [Tutor] Help with a Conversion

2017-01-05 Thread S. P. Molnar
On 01/05/2017 11:41 AM, Alan Gauld via Tutor wrote: On 05/01/17 13:29, S. P. Molnar wrote: Fortran II using punched paper tape. Yes, am a rather elderly . . .). You are not the only one, there are at least 2 more of us on this list that started in that era... short program to change

[Tutor] Help with a Conversion

2017-01-05 Thread S. P. Molnar
list (the corresponding wavelength is 400). To change the frequency to wave length I did the following: p=1/1e7 wave_length = p*np.array(frequency) (The relationship between wavelength and frequency is: wavelength = 1.0e7/frequency, where 1e7 is the speed of light) Apparently whhat I have

Re: [Tutor] Recommendations for best tool to write/run Python

2016-03-02 Thread Dave P
On Wed, Mar 2, 2016 at 1:26 PM, Lisa Hasler Waters wrote: > Hello everyone, > > I am new to Python, as are my middle school students. We are using Python > 3.5.1 IDLE to write and run our (simple) code. However, this tool does not > seem to be the best way to write longer code or to be able to re-

Re: [Tutor] unittest not working

2015-11-19 Thread Dave P
On Thu, Nov 19, 2015 at 8:25 AM, Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, so > I'm sure I'm missing

[Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Flynn, Stephen (L & P - IT)
Afternoon, Python 3. I'm iterating through a list and I'd like to know when I'm at the end of the said list, so I can do something different. For example list_of_things = ['some', 'special', 'things'] for each_entry in list_of_things: print(each_entry) if each_ent

Re: [Tutor] Design question: Web-based vs. desktop-based vs. desktop-based with data backed up to web server with a tablet thrown in for all cases?

2015-07-19 Thread Dave P
On Jul 19, 2015 5:43 AM, "Laura Creighton" wrote: > > In a message of Sun, 19 Jul 2015 16:27:13 +1000, "Steven D'Aprano" writes: > >I'm not sure if it runs on Macs, but it should work on Android, Windows, > >and Linux, and of course it is entire Python-based. > > Python 2.7 only on for MacOSX. Py

Re: [Tutor] Problem in packages

2015-07-01 Thread Flynn, Stephen (L & P - IT)
> Python version 2.7.10. > I have problem in installing .whl format packages. > what version of setuptools is required for .whl format packages. > I have installed Setuptools version 0.6.0 and upgraded pip to 7.0.3. > wndows 7 powershell 1. > I tried installing setuptools 18.0 but it is also in .wh

Re: [Tutor] ArcGIS Create a python script to generate north-facing aspect raster from digital elevation model

2015-03-31 Thread P McCombs
On Mar 21, 2015 1:22 AM, "Michael Omohundro" wrote: > > Does anyone know how to create a python script to generate an aspect raster from the input elevation in a digital elevation model? > This topic is out of the normal scope of the mailing list. It's hard to say if you are having a python issue

Re: [Tutor] Real world use of recursion

2014-09-10 Thread Flynn, Stephen (L & P - IT)
> Sorry to bother you all with what you might consider trivia, but someone > in my course forum posted this statement: > > "I have never seen or heard of real uses of recursion except for proving > cleverness," > > so I thought I would ask you all if that is true. Is it really not used > in real

[Tutor] sys module - what does "It is always available" mean in the docs?

2014-08-21 Thread Flynn, Stephen (L & P - IT)
The documentation (https://docs.python.org/3/library/sys.html) for Python 3.4.1 says that "This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available." I interpreted that last sentence as

Re: [Tutor] Exercise to work on

2014-08-14 Thread P McCombs
On Aug 12, 2014 3:29 PM, "keith papa" wrote: > > Hi, am a newbie to python and I wondering if you guys can give me some exercise to work on. I have learned: print function , if function , strings, variables, and raw_input. The more the better Checkio.org is a game made of python coding challenges

Re: [Tutor] Need help with python script

2014-08-04 Thread P McCombs
Sorry, I missed copying this to the list. On Aug 4, 2014 8:13 AM, "P McCombs" wrote: > > > On Jul 31, 2014 4:50 PM, "McKinley, Brett D." wrote: > > > > I would like to see if someone can help me with a python script. I’m trying to export a file geodat

Re: [Tutor] How to create web interface?

2014-05-20 Thread P McCombs
Thank you all for your responses. This is exactly the information I was looking for. Paul McCombs On Tue, May 20, 2014 at 4:36 PM, Alan Gauld wrote: > On 20/05/14 21:00, P McCombs wrote: >> >> On May 14, Danny Yoo wrote: >>>> >>>> Another option might be t

[Tutor] How to create web interface?

2014-05-20 Thread P McCombs
On May 14, Danny Yoo wrote: > > Another option might be to turn your program into a web site, so that > > the interface is the web browser, which everyone is getting used to > > these days. But this, too, is also... involved. :P I have a little volunteer scheduling application

Re: [Tutor] /tutorial/controlflow.html "break statement"

2013-12-02 Thread Flynn, Stephen (L & P - IT)
> The script studied was : > > for n in range(2, 10): > for x in range(2, n): > if n % x == 0: > print(n, 'equals', x, '*', n//x) > break > else: > print(n, 'is a prime number') The code above is not what you ran below, in idle. Look at the in

Re: [Tutor] Scheduling Python Execution

2013-04-15 Thread Flynn, Stephen (L & P - IT)
> I want to write a twitter bot which runs on a specific time. For an > idea, I'd like to have this twitter bot tweet every sunrise and > sunset, everyday. Since everyday the sunrise and the sunset time are > vary, what are the best way to do it? Have the bot calculate sunrise and sunset for the f

Re: [Tutor] How to extract a float from an instancemethod call

2013-04-08 Thread Flynn, Stephen (L & P - IT)
Aha - another EdX 6.00 Python course student. > Traceback (most recent call last): >File "/Users/Sydney/Documents/6.00x Files/Problem > Sets/ProblemSet7/ps7 copy.py", line 303, in > testRobotMovement(StandardRobot, RectangularRoom) >File "ps7_verify_movement.py", line 12, in testRobo

[Tutor] Python 3.2: processing text files in binary mode, because I want to remove carriage returns and line feeds...

2012-08-23 Thread Flynn, Stephen (L & P - IT)
Python 3.2, as in the subject, although I also have 2.7 on this machine too. I have some data which contains text separated with field delimiters (|~) and a record terminator (||) 12345600990|~5229|~990|~0|~4|~1|~2006-09-08|~13:29:39|~some text.|~xxx, x|~|| 12345600991|~

Re: [Tutor] converting EBCIDIC to ASCII

2012-07-16 Thread Flynn, Stephen (L & P - IT)
> -Original Message- > From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto:tutor- > bounces+steve.flynn=capita.co...@python.org] On Behalf Of Steven D'Aprano > Sent: Saturday, July 14, 2012 2:42 AM > To: tutor@python.org > Subject: Re: [Tutor] converting EBCIDIC to ASCII > > Pr

Re: [Tutor] converting EBCIDIC to ASCII

2012-07-16 Thread Flynn, Stephen (L & P - IT)
I am trying to convert an EBCIDIC file to ASCII, when the records are fixed length I can convert it fine, I have some files that are coming in as variable length records, is there a way to convert the file in Python? I tried using no length but then it just reads in to a fixed buffer size and I can

Re: [Tutor] Simple text file processing using fileinput module."Grabbing successive lines" failure

2012-07-03 Thread Flynn, Stephen (L & P - IT)
Hi Peter, > As you already learned the csv module is the best tool to address your > problem. Yup - it's almost going to make my little coding exercise trivial. :) > However, I'd like to show a generic way to get an extra item in a for- > loop. [snip] > Here's a self-contained example: > > >>

Re: [Tutor] Simple text file processing using fileinput module. "Grabbing successive lines" failure

2012-07-03 Thread Flynn, Stephen (L & P - IT)
> On 02/07/12 18:39, David Rock wrote: > > > Essentially, your problem isn't with using fileinput, it's with how you > > handle each line that comes in. > > The immediate problem is with mis-using fileinput. > But once you solve that you then have to deal with the > other issues David raises. >

[Tutor] Simple text file processing using fileinput module. "Grabbing successive lines" failure

2012-07-02 Thread Flynn, Stephen (L & P - IT)
Tutors, Whilst having a play around with reading in textfiles and reformatting them I tried to write a python 3.2 script to read a CSV file, looking for any records which were short (indicating that the data may well contain an embedded CR/LF. I've attached a small sample file with a "split rec

Re: [Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-01 Thread Flynn, Stephen (L & P - IT)
> I have seen Python manual, it says <#! /usr/bin/env python> > But snippet manager of many text editing programs have <#!/usr/bin/env > python>. Python is a strongly typed language, which one is correct? That's not python code - it's interpreted by the shell (on Linux/Unix) to determine what to

[Tutor] Python 3.2 - difference between out of dir() and help()

2012-03-08 Thread Flynn, Stephen (L &amp; P - IT)
Pythonistas, Tinkering around this morning and noticed the following when I created a tuple and asked for a dir() on it and some help() on it. >>> x=('rod','jane','freddy') >>> dir(x) ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format

Re: [Tutor] Python with HTML

2012-01-29 Thread P.
> > I want to make a web page which has to include some python script and html >> tags as well, am not getting how to do that . >> > ** Hi, Maybe a quick and small solution is here : http://karrigell.sourceforge.net/en/index.html It doesn't seem to be a very living project, but it can be a solutio

Re: [Tutor] Read in text file containing non-English characters

2012-01-13 Thread Francis P. Boscoe
>You don't show even a snippet of code. If you are asking >for help here, it is good form to show us your code. Since >you don't state how you are reading the data and how you are >printing the data, we can't help much. Here are some tips: > > * Consider learning how to use the csv mod

[Tutor] read in text file containing non-English characters

2012-01-12 Thread Francis P. Boscoe
Given a simple text file of departments, capitals, longitude and latitude separated by commas Ahuachapán,Ahuachapán,-89.8450,13.9190 Cabañas,Sensuntepeque,-88.6300,13.8800 Cuscatlán,Cojutepeque,-88.9333,13.7167 I would like to know to how to read in the file and then access arbitary rows in the

[Tutor] cPickle and shjelving

2011-08-24 Thread Warren P. Jones
Hi, I am new to python. I am having slight issue in using the cPickle and shelving function. Here is what i want the program need to do: Open an file with employees in it with relevant information like: employee number, surname and department. I also need to add an employee with the relevant

Re: [Tutor] "Object designer" applications - are there any?

2011-08-08 Thread Flynn, Stephen (L &amp; P - IT)
ple as and when I get stuck or want some advice on the best way to proceed, so I guess by the end of it, you'll all be as sick of this as I will be. Share the misery... S From: ALAN GAULD [mailto:alan.ga...@btinternet.com] Sent: Friday, August 05, 201

Re: [Tutor] "Object designer" applications - are there any?

2011-08-05 Thread Flynn, Stephen (L &amp; P - IT)
> > However, I've not done much OOP at all > > I'm not sure you need OOP for this. As you say a "routine" ie a function > might be all you need along with some data structures - probably > dictionaries to define the translations needed. I suspect you're correct Alan, but as I'm using this an a le

Re: [Tutor] "Object designer" applications - are there any?

2011-08-05 Thread Flynn, Stephen (L &amp; P - IT)
his, but if I'm going to be learning python via a project, I might as well do it properly). S. From: Christian Witts [mailto:cwi...@compuscan.co.za] Sent: Friday, August 05, 2011 1:10 PM To: Flynn, Stephen (L & P - IT) Cc: Tutor List Subject: Re:

[Tutor] "Object designer" applications - are there any?

2011-08-05 Thread Flynn, Stephen (L &amp; P - IT)
I'm about to embark on a project in Python (primarily in order to learn the language and equally importantly, to make my life easier at work). I'm an IBM MVS Operations Analyst by trade by recently I've been spending more and more time working on Data Migrations; legacy systems in VSAM files, AD

Re: [Tutor] File parsing

2011-06-16 Thread Neha P
Thanks James I guess i have to use the same code for text in yellow... seems like ther's no other way...  Regards, Neha From: James Reynolds To: Neha P Cc: "tutor@python.org" Sent: Thursday, June 16, 2011 2:43 PM Subject: Re: [Tutor] File pars

[Tutor] File parsing

2011-06-16 Thread Neha P
Hi all, I know below query may sound silly, but can somebody suggest any better way of doing this: It would be helpful. I need to read a file line by line and print each line starting from the last word first:   C:\Python26>type file_reversing_program.txt import sys import string f_obj=open(s

[Tutor] subprocess.Popen() OR subprocess.call() ?

2011-06-12 Thread Neha P
Hi all, I am newbie and want to know what is the difference between subprocess.Popen() and subprocess.call() ? when is it best to use each one? Any help appreciated!!  Regards, Neha___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc

Re: [Tutor] Excited about python

2011-06-10 Thread Flynn, Stephen (L &amp; P - IT)
Python manuals from http://www.python.org/doc/ From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto:tutor-bounces+steve.flynn=capita.co...@python.org] On Behalf Of Kaustubh Pratap chand Sent: Friday, June 10, 2011 1:41 PM To: tutor@python.org Subject

[Tutor] Python Interview Questions..

2011-05-24 Thread Neha P
Hey I'll be appearing for Job Interviews and wondering if anybody of you appeared for a Python Interview Or if on the other end as an interviewer.   Can you please share the questions asked?   That will be of great help :) Regards, Neha___ Tutor maillis

Re: [Tutor] python scripting using "./"

2011-05-24 Thread Flynn, Stephen (L &amp; P - IT)
From: Hank Wilkinson [mailto:hwilkin...@triad.rr.com] Sent: Tuesday, May 24, 2011 2:25 PM To: Flynn, Stephen (L & P - IT) Cc: tutor@python.org Subject: Re: [Tutor] python scripting using "./" John-Wilkinsons-iMac:p31summerfield wilkinson$ ls -al /usr/local/bin/python ls: /usr

Re: [Tutor] python scripting using "./"

2011-05-24 Thread Flynn, Stephen (L &amp; P - IT)
What is your Python executable called? You refer to it as "python" on the command line but your "#!" line in your script refers to the executable as "python3.1". tried it with just "python" in the #! Line? Check the output of 'ls -al /usr/local/bin/pytho*'... S. -Original Message- From:

Re: [Tutor] Error in executing 'Python Filename.py'.

2011-05-19 Thread Neha P
Hey all, got the solution... Thanks for the help :) :) Just needed to from  C:\Python26>Python hello.py Its working fine... From: Neha P To: "tutor@python.org" Sent: Thursday, May 19, 2011 4:14 PM Subject: [Tutor] Error in executing 'Python

[Tutor] Error in executing 'Python Filename.py'.

2011-05-19 Thread Neha P
C:\>python hello.py 'python' is not recognized as an internal or external command, operable program or batch file. C:\>cd python26 C:\Python26>python Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more in

Re: [Tutor] can I walk or glob a website?

2011-05-18 Thread Flynn, Stephen (L &amp; P - IT)
Pardon the crappy quoting - forced to use Exchange. Top posted too... the shame. What about curl and libcurl? http://curl.haxx.se/ S. -Original Message- From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto:tutor-bounces+steve.flynn=capita.co...@python.org] On Behalf Of Alan Ga

[Tutor] Need help with arrays

2011-05-04 Thread Patrick P .
Hello, I hope this is the right way to ask my question, if not, sorry to bother you. Maybe you can tell me who to ask. Ok so here is my code import numpy as np nH = 2.2 nL = 1.7 welle = 0.5 wurzel = (8.85*10**(-12) *

Re: [Tutor] Write new line(enter) in txt

2011-03-28 Thread Flynn, Stephen (L &amp; P - IT)
.. you're on Windows where an end of line is marked via a CR + LF. S. From: Susana Iraiis Delgado Rodriguez [mailto:susana.delgad...@utzmg.edu.mx] Sent: Monday, March 28, 2011 4:28 PM To: Flynn, Stephen (L & P - IT) Cc: tutor@python.org Subjec

[Tutor] How to notify/handle an error?

2010-10-31 Thread dave p. guandalino
Which of the following ways is better to handle something wrong? Many thanks. # First: def is_valid_project(): # Do checks and valorize is_a_valid_project accordingly return is_a_valid_project # True / False # caller side if is_valid_project(): pass # do stuffs with valid project else

Re: [Tutor] Python Book recomandation!

2010-07-15 Thread Guilherme P. de Freitas
dvise most beginners to learn Python 3. -- Guilherme P. de Freitas http://www.gpfreitas.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Keeping a list of attributes of a certain type

2010-01-15 Thread Guilherme P. de Freitas
bers" list. Otherwise, (b) is better. Right? In my application, I will do many more lookups on the members list than adding/removing members (this sounds weird, feels like I'm Dr. Frankenstein), so I will go with (b). Thanks again for all the suggestions, Guilherme -- Guilherme P.

Re: [Tutor] Keeping a list of attributes of a certain type

2010-01-15 Thread Guilherme P. de Freitas
Thanks everybody for all the suggestions and ideas. I still did not have time to look them all over, but I will. Thanks again! Best, Guilherme On Thu, Jan 14, 2010 at 4:52 AM, Alan Gauld wrote: > > "Guilherme P. de Freitas" wrote > >> Here is my problem. I have two cl

Re: [Tutor] Keeping a list of attributes of a certain type

2010-01-13 Thread Guilherme P. de Freitas
) else: object.__delattr__(self, obj) john = Body() john.arm = Member() print(john.members) del john.arm print(john.members) On Wed, Jan 13, 2010 at 6:24 PM, Guilherme P. de Freitas wrote: > Hi everybody, > > Here is my problem. I have two classes, 'Body' and

[Tutor] Keeping a list of attributes of a certain type

2010-01-13 Thread Guilherme P. de Freitas
deleted. I need any instance of 'Body' to keep an up-to-date list of all its attributes that belong to the class 'Member'. How do I do this? Best, Guilherme -- Guilherme P. de Freitas http://www.gpfreitas.com ___ Tutor maillist -

Re: [Tutor] advice on creating and working with a complex data structure

2009-07-20 Thread Lucas P Melo
Serdar Tumgoren wrote: And of course, please let me know if there's a simpler approach I'm overlooking that would meet my requirements. As always, the advice is appreciated. You could just create some classes with methods to handle the insertion and deletion of those data. You could also keep

[Tutor] python and serial port

2009-06-09 Thread Ranjeeth P T
sir, I am new to python i want to communicate i.e send and receive b/n an arm device and pc via a serial port,arm part is fine i want to know abt the pc part in python which library and module should i use and also the funtions. Please help me Ranjeeth p t http://ranjeethpt.wordpress.com

Re: [Tutor] Encode problem

2009-05-04 Thread Pablo P. F. de Faria
in write return self.writer.write(data) File "/usr/lib/python2.5/codecs.py", line 303, in write data, consumed = self.encode(object, self.errors) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 27: ordinal not in range(128) So, in "str(value)

Re: [Tutor] Encode problem

2009-05-04 Thread Pablo P. F. de Faria
he App (if I change . But this is very problematic to have to change Site.py in every computer... So I wonder if there is a way to replace the settings in Site.py only for my App. 2009/5/1 Kent Johnson : > On Fri, May 1, 2009 at 4:54 PM, Pablo P. F. de Faria > wrote: >> Hi, Kent. >&

[Tutor] Encode problem

2009-05-01 Thread Pablo P. F. de Faria
Hi, all. I need some help. I'm trying to save a configuration file, using ConfigParser. The code is the following: self.cfg.write(codecs.open(self.properties_file,'w','utf-8')) As one can see, the character encoding is explicitly UTF-8. But ConfigParser keeps trying to save it as a 'ascii' file

[Tutor] Newbie to Python

2007-12-08 Thread Fred P
Hey everyone, New to python, but not so scripting. Have some experience with C++, but more experience with LUA, CShell, and other types of scripting similar to those. I want to learn Python, and I have decided I would like my first project to be a collection program. I would like to provi

[Tutor] Learning Python

2007-09-29 Thread Fred P
Hey Everyone, I am completely new at python, but not new to programming or scripting. I have a couple of years of LUA scripting experience, about a year of C++ classes, and used to be very efficient at c-shell scripting in unix. My question for you guys: 1) How do I get Started? 2) Recom

[Tutor] help me and ill love u!!! :)

2007-03-21 Thread p l
hello tutor! im a new python programmer and iv been given a task to get as much details that i can on my system memory... now, i have allready found how to get the total physical memory and the avalible memory.. iv also found how to get the virtual mem and a few more stuff... but now im stuck!!

Re: [Tutor] how to wirte code In python :str = (a>b?"Yes":"NO")

2007-02-16 Thread Michael P. Reilly
On 2/16/07, Wolfram Kraus <[EMAIL PROTECTED]> wrote: On 16.02.2007 08:01, xiufeng liu wrote: > Hi, all, > > In python if there is any similar way like in Java, or C++ to express > the following: > str = (a>b?"Yes":"NO") > > > thanks! In Python 2.5 you can do the following (untested): str = "Ye

Re: [Tutor] Replying to the tutor-list

2007-02-16 Thread Michael P. Reilly
On 2/16/07, ALAN GAULD <[EMAIL PROTECTED]> wrote: > However, the "standard behavior" at the time was that > replies went back to the mailing list, not to the original sender. But the mailing list was the original sender so it was all wonderfully consistent. Reply goes to sender only, which hap

  1   2   >