Trying to choose between python and java
Hi All, I am currently trying to decide between using python or java and have a few quick questions about python that you may be able to help with. #1 Does python have something like javas .jar packages. A jar file contains all the program files and you can execute the program with java -jar program.jar I am sort of hoping python has something like this because I feel it makes it easier to distribute between platforms e.g. linux, mac windows etc. #2 What database do people recommend for using with python that is easy to distribute across linux, mac, windows. #3 Is there any equivalent to jfreechart and jfreereport (http://www.jfree.org for details) in python. #4 If I write a program a test it with python-wxgtk2.6 under linux are the program windows likely to look right under windows and mac? #5 someone said that they used to use python but stopped because the language changed or made stuff depreciated (I can fully remember which) and old code stopped working. Is code written today likely to still work in 5+ years or do they depreciate stuff and you have to update? Anyway hopefully someone can help me out with these last few questions I have. Also does anyone else have any useful comments about python vs java without starting a flame war. -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to choose between python and java
Hi All, Thanks to all that replied. I noticed that someone said that the way you used regular expressions changed at some point. That is probably what upset the person I was talking to about python they are a huge perl fan and use regular expressions heavily. The reason for asking about the .jar type functionality was to try and make it easier to distribute the application as some people said. I run linux systems and if I want to give the app to a windows user then I don't really want to muck about trying to create a windows install for them as I don't personally have a copy of windows to do it with so I thought that just giving them one file and telling them to install the run time environment would make it easier. I tend to use the shebang #!/usr/bin/env python in my scripts so far but I imagine that having that would not work on say windows. Or is there some kind of file extension association for people running windows instead of the shebang? I saw on the python site a slide from 1999 that said that python was slower then java but faster to develop with is python still slower then java? -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
Re: how do I count spaces at the beginning of a string?
walterbyrd wrote: > The strings start with whitespace, and have a '*' or an alphanumeric > character. I need to know how many whitespace characters exist at the > beginning of the string. > Hi, I am new to python and just really learning but this is what I came up with. #!/usr/bin/env python def main(): s = " abc def ghi" count = 0 for i in s: if i == ' ': count += 1 else: break print count if __name__ == '__main__': main() -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
Re: how do I count spaces at the beginning of a string?
Anthony Irwin wrote: > walterbyrd wrote: >> The strings start with whitespace, and have a '*' or an alphanumeric >> character. I need to know how many whitespace characters exist at the >> beginning of the string. >> > > Hi, > > I am new to python and just really learning but this is what I came up > with. > > #!/usr/bin/env python > > def main(): > s = " abc def ghi" > count = 0 > > for i in s: > if i == ' ': > count += 1 > else: > break > > print count > > if __name__ == '__main__': > main() > Ahh even better would be to use some of the python library functions that I am still finding more about. s = " abc def ghi" print (len(s) - len(s.lstrip())) I am really starting to like python the more I use it. -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
problem with import in python 2.2.3
Hi, I have written a python script that works perfectly in python 2.4.4 and python 2.4.3 but when I try to use the same script on an older system with python 2.2.3 I get the following error. ./backup_all_mysql_databases.py Traceback (most recent call last): File "./backup_all_mysql_databases.py", line 5, in ? from datetime import date ImportError: No module named datetime Does anyone know why the datetime module is not being found in python 2.2.3 and how I can make the script work in the older version of python? -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
Re: problem with import in python 2.2.3
Hi Guys, Thanks for the replies I ended up rewriting my code to use the time.strftime() library but unfortunately the MySQLdb module I use needs python 2.3 or higher so it looks like I have to update python on the older system anyway. -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
Re: omissions in python docs?
7stud wrote: > On May 17, 7:23 pm, 7stud <[EMAIL PROTECTED]> wrote: > > By the way, have the python doc keepers ever visited the php docs? In > my opinion, they are the best docs of any language I've encountered > because users can add posts to any page in the docs to correct them or > post code showing how to get around various idiosyncrasies when using > the functions. > Hi, I also like the php docs and love that you can type any function into the search at php.net and the documentation just comes up and there is example code and then user comments also. -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questions
jay wrote: > Hi, > > I'm totally new to Python and was hoping someone might be able to answer > a few questions for me: > > 1. What are your views about Python vs Perl? Do you see one as better > than the other? I have written some scripts in both perl and python and to me python feels more like a modern programming language then perl does. As I am learning both languages I can also say that I was writing useful python code as I was learning python but had to do more reading with perl to write similar levels of code but maybe thats just me. > > 3. Currently, I write most of my code with Xcode (on the Mac platform) > using Applescript. This gives me GUI capabilities. Is there anything > you'd recommend that I could use for Python that would give me a GUI > interface? I'd like this to be able to work for both the Mac and > Windows platforms. I've been reading a little about 'Claro Graphics > Toolkit' and 'PyGUI'... would you recommend either of those? I'll be > writing code on a Mac so I need something that will run on that system. I have used wxpython and did the tutorial listed in their wiki and ran it on linux and mac and they looked like native applications in both and the same is meant to happen in windows but I don't have windows so have not tried it myself. To do this on the mac I installed the universal python 2.4 from the python site and the wxpython mac install and just double clicked a python file with a .pyw and it executed like a normal app. Originally I had a .py file extension but that does not execute the python script. -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
getting output from a command into a list to work with
Hi All,
I would like to run the command below and have each line from the
output stored as an element in a list.
find /some/path/ -maxdepth 1 -type f -size +10k -exec ls -1 '{}' \
The reason for this is so I can then work on each file in the
following manner
var = command
for i in var:
# do stuff to file code here
not sure the best way to get the output of the command so each line of
output is one element in the list.
--
Kind Regards,
Anthony Irwin
http://www.irwinresources.com
http://www.makehomebusiness.com
email: anthony at above domains, - www.
--
http://mail.python.org/mailman/listinfo/python-list
Re: trouble with wxPython intro
Daniel Gee wrote: > I'm trying to learn WxPython with the tutorial: > http://wiki.wxpython.org/Getting_Started > > But I can't seem to get the example for events to work. I pasted the > code they had directly into an interpreter and it got a dialog to > appear and the program was able to close itself, but my own copy won't > work. As far as I can see, it isn't at all different except for the > name of the main frame, and so I differ to you for help. --- code snipped > #Menu setup > filemenu = wx.Menu() > filemenu.Append(wx.ID_ABOUT,"&About","Info about the program") Hi, make it the following instead. filemenu.Append(ID_ABOUT,"&About","Info about the program") > filemenu.AppendSeparator() > filemenu.Append(wx.ID_EXIT,"E&xit","Terminate the program.") And again make it the following. filemenu.Append(ID_EXIT,"E&xit","Terminate the program.") --- code snipped -- Kind Regards, Anthony Irwin http://www.irwinresources.com http://www.makehomebusiness.com email: anthony at above domains, - www. -- http://mail.python.org/mailman/listinfo/python-list
Databases with python
Hi All, I am interested in playing with python some more and am looking at writing an app with data stored in a database. I have experience with mysql but thought that their may be other better databases that can be more easily distributed with the program does anyone have any suggestions here? I only use linux myself but I can foresee some windows people wanting to use what I create and if I am going to support windows then I might as well support mac too. (this is to say that the database should support the 3 main platforms in use) Also is wxpython the best cross platform gui library it seems to be the best I have seen so far. -- Kind Regards, Anthony Irwin http://www.irwinresources.com email: anthony at the above domain, - www. -- http://mail.python.org/mailman/listinfo/python-list
