Re: [Tutor] Best IDE for Python

2007-01-26 Thread Mark Thomas
On 1/26/07, OkaMthembo <[EMAIL PROTECTED]> wrote:
> how useable is vim on Windows?

Very! I've used Vim on Windows since the 5.3 version, it only gets
better. Like Alan said there is a learning curve, but once you've "got
it" there is no going back.

> i wish i could learn Unix. which distro do you think is good to learn?

If you just want to have the power of some Unix tools then take a look
at http://gnuwin32.sourceforge.net/ , they all run fine in the
standard Windows shell. If you want to try a Unix variant then find
one of the many "Live" CD's out there which you can use before you
slice up your disk. I'm a big fan of NetBSD but at the moment I'm
running OpenBSD 4.0 on my PIII laptop and it's very nice.

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Tutorial topic available

2006-02-26 Thread Mark Thomas
On 2/26/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
> I've just uploaded the latest tutorial topic covering inter-process
> communications. It covers pipes and the use of fork().
>
> Enjoy, as ever feedback is welcomed.

Thanks Alan, your pages are a great source of information for us newbies.

--
 _
( ) Mark Thomas ASCII ribbon campaign
 X www.theswamp.org   - against HTML email
/ \
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to strip both single and double quotes

2005-10-05 Thread Mark Thomas
On 10/5/05, Dick Moores <[EMAIL PROTECTED]> wrote:
> The text will contain "words" beginning or ending with non-alphabetic
> characters. To strip them off I use string.strip([chars]). My question is
> how to use strip just once to get rid of both kinds of quotes, single and
> double. It seems necessary to do it something like this:

Not sure what you mean by 'words' but how about something like this.
[x.strip('\' \" () * & ^ % $ # < ') for x in word.split()]

Example:
>>> str = 'this has special characters \" \' ()*&^%$# << '
>>> [x.strip('\' \" () * & ^ % $ # < ') for x in str.split()]
['this', 'has', 'special', 'characters', '', '', '', '']

--
 _
( ) Mark Thomas ASCII ribbon campaign
 X www.theswamp.org   - against HTML email
/ \
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2005-07-06 Thread Mark Thomas
On 7/6/05, Michael Huster <[EMAIL PROTECTED]> wrote:
> In python under windows, how can I create and access a file on the Desktop? 
> The following do NOT work:
 
How about...

>>> userp = os.getenv('USERPROFILE') + '\\Desktop\\MyFile.txt'
>>> fo = file(userp, 'w')
-- 
 _
( ) Mark Thomas ASCII ribbon campaign
 X www.theswamp.org   - against HTML email
/ \
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Simple string processing problem

2005-05-13 Thread Mark Thomas
On 13 May 2005 21:59:58 +0100, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> The file:
> 
> ScerACTAACAAGCTGGTTTCTCC-TAGTACTGCTGTTTCTCAAGCTG
> Sparactaacaagctggtttctcc-tagtactgctgtttctcaagctg
> Smikactaacaagctgtttcctcttgaaatagtactgctgcttctcaagctg
> Sbayactaacaagcactgattgaaatagtactgctgtctctcaagctg
>   * ** **     ***   * ***  *
> 
> ScerTGCTCACCAATTTATCCCAATTGGTTTCGGTATCAAGAAGTTGCAAATTAACTGTG
> SparTGCTCACCAATTTATCCCAATTGGTTTCGGTATCAAGAAGTTGCAAATTAACTGTG
> SmikTGCTCACCAATTCATCCCAATTGGTTTCGGTATCAAGAAGTTGCAAATTAACTGTG
> SbayTGCTCACCAATTCATCCCAATTGGTTTCGGTATCAAGAAATTGCAAATTAACTGTG
> * ** *   *   *  ** * ** 
> 
> ScerACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAAaaggctt-ataa
> SparACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAAaaagctttataa
> SmikACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAAgaagctctataa
> SbayACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAAgaagctctataa
>  * ***  
> 
> Sceractataattaacattaa---agcacaacattgtaaagattaaca
> Sparactataataaacatcaa---agcacaacattgtaaagattaaca
> Smikactataattaacatcgacacgacaacaacaacattgtaaagattaaca
> Sbayactataacttagcaacaacaacaacaacaacatcaacaacattgtaaagattaaca
> ***     * **  **

How about some RE action.

>>> import re
>>> pat = re.compile('^(S[a-z]{3}\s*[A-Z]+).*$')
>>> fr = file('dna','r')
>>> for line in fr:
... m = pat.match(line)
... if m:
... print m.group(1)
...
ScerACTAACAAGCTGGTTTCTCC
ScerTGCTCACCAATTTATCCCAATTGGTTTCGGTATCAAGAAGTTGCAAATTAACTGTG
SparTGCTCACCAATTTATCCCAATTGGTTTCGGTATCAAGAAGTTGCAAATTAACTGTG
SmikTGCTCACCAATTCATCCCAATTGGTTTCGGTATCAAGAAGTTGCAAATTAACTGTG
SbayTGCTCACCAATTCATCCCAATTGGTTTCGGTATCAAGAAATTGCAAATTAACTGTG
ScerACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA
SparACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA
SmikACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA
SbayACCACGTCCAATCTACCGATATTGCTGCTATGCATTATAA


-- 
 _
( ) Mark Thomas ASCII ribbon campaign
 X www.theswamp.org   - against HTML email
/ \
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Cryptography Toolkit

2005-04-01 Thread Mark Thomas
On Apr 1, 2005 6:45 AM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> It works if you make a new XOR object for the decryption:
> 
> from Crypto.Cipher import XOR
> 
> obj_xor = XOR.new("string")
> str_encrypt = "encrypt this string"
> print str_encrypt
> 
> xored = obj_xor.encrypt(str_encrypt)
> print xored
> 
> obj_xor = XOR.new("string")
> print obj_xor.decrypt(xored)
> 
> Kent

Excellent !!
Many thanks Kent.
-- 
 _
( ) Mark Thomas ASCII ribbon campaign
  X www.theswamp.org   - against HTML email
/ \
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Cryptography Toolkit

2005-03-31 Thread Mark Thomas
On Thu, 31 Mar 2005 09:14:03 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote:
> If you post your code and the complete error message including the stack 
> trace we may be able to help.
> 
> Kent

Thanks Ken

I'm getting closer to making this work using the XOR cipher. Here's
what I'm doing.



from Crypto.Cipher import XOR

obj_xor = XOR.new("string")
str_encrypt = "encrypt this string"
xored = obj_xor.encrypt(str_encrypt)
xored
'\x16\x1a\x11\x1b\x17\x17\x07T\x06\x01\x07\x14S\x07\x06\x1b\x07\t\x14'
obj_xor.decrypt(xored)
"bhxupds&oo`g'uou`z`" <== *confused by this output*



Close but no cigar!! *grin*

-- 
 _
( ) Mark Thomas ASCII ribbon campaign
 X www.theswamp.org   - against HTML email
/ \
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Cryptography Toolkit

2005-03-31 Thread Mark Thomas
Does anyone have some examples on the use of A.M. Kuchling's Python
Cryptography Toolkit? I've tried his examples but get "AttributeError"
and "TypeError". What I'm trying to do is encrypt/decrypt a file. I'm
using Python 2.3 on xp pro.

Thanks
-- 
 _
( ) Mark Thomas ASCII ribbon campaign
 X www.theswamp.org   - against HTML email
/ \
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor