[FAQTS] Python Knowledge Base Update -- June 20th, 2000

Fiona Czuczman fiona at sitegnome.com
Tue Jun 20 23:11:07 EDT 2000


Hello Python Folk!

Below are the entries I've entered into http://python.faqts.com today.

cheers,

Fiona Czuczman


## New Entries #################################################


-------------------------------------------------------------
What module would I use to make serial I/O?
http://www.faqts.com/knowledge-base/view.phtml/aid/3888
-------------------------------------------------------------
Fiona Czuczman
richard_chamberlain

Have a look at ftp.python.org/pub/python/contrib/sio-151.zip


-------------------------------------------------------------
Is there a Python module that has functions in it to manipulate Dbase tables and indexes?
http://www.faqts.com/knowledge-base/view.phtml/aid/3890
-------------------------------------------------------------
Fiona Czuczman
Anders M Eriksson

You don't say which version of dBASE and not on which platform you
are, so let's assume that you are using Windows 9x/NT/2000.

The only real alternative today is to use ODBC!

The win32-all comes with an ODBC modules that works OK, if you want to
spice it up a bit get mxODBC (seach on Vaults of Parnassus)


-------------------------------------------------------------
How can I convert a hex number to an integer?
http://www.faqts.com/knowledge-base/view.phtml/aid/3886
-------------------------------------------------------------
Fiona Czuczman
Jarkko Torppa, Thomas Wouters

>>> eval('0x32')
50
>>> import string
# Forces base to 16(hex)
>>> string.atoi('32',16)
50
# Guesses base from leading characters
>>> string.atoi('0x32',0)

Note that in Python 1.6, you can do the above two things like this:

>>> int('0x32',16)
50
>>> int('0x32',0)
50


-------------------------------------------------------------
How do I get a file list via an ftp connection?
http://www.faqts.com/knowledge-base/view.phtml/aid/3887
-------------------------------------------------------------
Fiona Czuczman
Thomas Weholt

I think you could do either a ls or dir, like so :

ftp = ftplib.... # open connection
file_list = ftp.dir()
or file_list = ftp.ls()

Just off the top of my head. Check the source of ftllib, it`s almost
self-explanatory.


-------------------------------------------------------------
Is anyone aware of a Computer Algebra System (CAS) i.e a mathematical software that is able to derivate, integrate, simplify, find limits, analytically - in python?
http://www.faqts.com/knowledge-base/view.phtml/aid/3885
-------------------------------------------------------------
Fiona Czuczman
Konrad Hinsen, Jonathan Epstein, Matt Feinstein

Pythonica isn't there yet, but it's an interesting start. More at:

       http://www.strout.net/python/pythonica.html

------------

Matlab has an interface to Maple (their "Symbolic Toolbox", I think).

It might be useful to study their API, and emulate it in a reasonable
(and hopefully legal) fashion in Python.

It's pretty simple, at least from the user's point of view. You
declare your symbolic variables a la

sym x y z;

and then just go ahead and use the symbolic variables in the
interpreter in algebraic or arithmetic expressions the same way you
would use numerical expressions-- all the arithmetic and algebraic
operators used by the interpreter are appropriately overloaded. There
is an accompanying suite of functions and state variables that control
how the symbolic stuff is done. There is also an 'Extended' symbolic
toolbox that gives the user direct access to the Maple kernel.


## Edited Entries ##############################################


-------------------------------------------------------------
How can I get the current date and time?
How do I print out the current time?
http://www.faqts.com/knowledge-base/view.phtml/aid/3600
-------------------------------------------------------------
Mike Hostetler, Fiona Czuczman
http://www.python.org/doc/current/lib/module-time.html

I didn't think that the official documentation was very clear on this 
(but it is there), so I'm adding it here.

If you do

>> import time
>> print time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))

You'll see something like:

2000-06-08 15:05:09

To dissect this:

time.time() gets the time in seconds since the epoch

time.localtime(secs) creates a tuple

time.strftime(string,tuple) creates a string of the time, using the 
formatting in "string" (that is what the "%"'s are doing there).
To see the full table of formatting options, see 
http://www.python.org/doc/current/lib/module-time.html







More information about the Python-list mailing list