Has anyone come across a quality program to turn plural words to singular
words? We don't want to use a stemmer. Thanks.
Dinesh___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listin
I use codecs to retain consistent unicode/utf-8 encoding and decoding for
reading/writing to files. Should the codecs be applied when using the
pickle/unpickle function? For example, the standard syntax is:
# pickle object
f = open(object, 'wb')
pickle.dump(object, f, 2)
# unpickle object
f
last citation ie. 463 U.S. 29, 43, 103 S.Ct. 2856,
2867, 77 L.Ed.2d 443 (1983). I tested it on another sample text and it missed
the last citation too.
Thanks!
Dinesh
From: Kent Johnson
Sent: Tuesday, February 10, 2009 4:01 AM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] Pi
I'm guessing that '499 n. 10' is a page reference ie. page 499, point number
10. Legal citations are all a mystery - they even have their own citation
bluebook (http://www.legalbluebook.com/) !
Dinesh
From: Kent Johnson
Sent: Tuesday, February 10, 2009 10:57 AM
To: Dine
You're probably right Paul. But, my assumption is that the originators of
legal documents pay a little more attention to getting the citation correct and
in the right format then say Joe Bloggs does when completing an address block.
I think that Kent has reached the end of his commendable eff
I want a regex to remove control characters (< chr(32) and > chr(126)) from
strings ie.
line = re.sub(r"[^a-z0-9-';.]", " ", line) # replace all chars NOT A-Z, a-z,
0-9, [-';.] with " "
1. What is the best way to include all the required chars rather than list
them all within the r"" ?
2.
r:
if c in set:
string.replace (c, r)
to give
> 'Chris Perkins : $$$-'
My solution is:
print ''.join[string.replace(c, r) for c in str if c in set]
But, this returns a syntax error. Any idea why?
Ta!
Dinesh
From: Kent Johnson
Sent: Thursday, Februar
;Product ConceptsHard candy with an innovative twist, Internet Archive: Wayback
Machine. [online] Mar. 25, 2004. Retrieved from the Internet http://www.confectionery-innovations.com>.'
This last bit doesn't work ie. replacing the unwanted chars with " " - eg.
'ConceptsHar
We want to standardize on unicode and utf8 and would like to clarify and verify
their use to minimize encode()/decode()'ing:
1. Python source files
Use the header: # -*- coding: utf8 -*-
2. Reading files
In most cases, we don't know the source encoding of the files being read. Do
we have to
Have a large number (> 1bn) of integer co-ordinates (i, j). The i are ordered
and the j unordered.
I want to create (j, i) with j ordered and i unordered ie.
from:
...
6940, 22886
6940, 38277
6940, 43788
...
to:
...
38277, 567
38277, 90023
38277, 6940
...
I've tried the dictionary route and
Does anyone know if 32-bit Python libraries will work with 64-bit Python under
64-bit Windows? For example, will 32-bit Numpy or Scipy work under 64-bit
Python? Cheers ...
Dinesh
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailma
Hi! I want to parse text and pickup sections. For example, from the text:
t = """abc DEF ghi jkl MNO pqr"""
... pickup all text between the tags and and replace with another
piece of text.
I tried
t = re.sub(r"\[A-Za-z0-9]\", "DBV", t)
... but it doesn't work.
How do you do this with
Hi Robert
I don't have an answer but can have my sympathy. I've been looking for a
quality pdf to text convertor for months and not turned up anything useful.
I've tried many free programs which are poor. I too wanted a Python-only
solution and tried pyPdf but that didn't work. Just today I
The best converter so far is pdftotext from http://www.glyphandcog.com/ who
maintain an open source project at http://www.foolabs.com/xpdf/.
It's not a Python library but you can call pdftotext from with Python using
os.system(). I used the pdftotext -layout option and that gave the best
resul
I'm processing tens of thousands of html files and a few of them contain
mismatched tags and ElementTree throws the error:
"Unexpected error opening J:/F2/663/blahblah.html: mismatched tag: line 124,
column 8"
I now want to scan each file and simply identify each mismatched or unpaired
tags (b
e-ID: <49f70a99.3050...@mwalsh.org>
Content-Type: text/plain; charset=us-ascii
A.T.Hofkamp wrote:
> Dinesh B Vadhia wrote:
>> I'm processing tens of thousands of html files and a few of them
>> contain mismatched tags and ElementTree throws the error:
>>
>> "U
ly to secure all this
information at present."
Dinesh
From: Kent Johnson
Sent: Tuesday, April 28, 2009 7:13 AM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] finding mismatched or unpaired html tags
On Tue, Apr 28, 2009 at 8:54 AM, Dinesh B Vadhia
wrote:
> I'
Dinesh
From: Kent Johnson
Sent: Tuesday, April 28, 2009 8:17 AM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] finding mismatched or unpaired html tags
On Tue, Apr 28, 2009 at 10:41 AM, Dinesh B Vadhia
wrote:
> This is the error and traceback:
>
> Unexpected error o
munity as usual!
Message: 5
Date: Tue, 28 Apr 2009 19:39:17 +0200
From: Stefan Behnel
Subject: Re: [Tutor] finding mismatched or unpaired html tags
To: tutor@python.org
Message-ID:
Content-Type: text/plain; charset=ISO-8859-1
A.T.Hofkamp wrote:
> Dinesh B Vadhia wrote:
>
Lie / Alan
re: If the source document was generated by a computer, and it produces invalid
markup, shouldn't that be considered a bug in the producing program?
Yes, absolutely but we don't have access to the producing program only the
produced xhtml files.
Dinesh
---
This could be a question for the comp.lang.python list but I'll try here first:
Say, you have a dictionary of integers, are the integers stored in a compressed
integer format or as integers ie. are integers encoded before being stored in
the dictionary and then decoded when read?
Dinesh
___
Dictionary, integer, compression
To: tutor@python.org
Message-ID:
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
"Dinesh B Vadhia" wrote
> Say, you have a dictionary of integers, are the integers stored
> in a compressed integer format or
The structure of the gzip files are:
gzip archive
folderA
folderB
list of folderC's
each folderC contains the target files
Within the archive, I want to open the gzip archive, open folderA, openFolderB
, get the list of target files in folderC, and extract
Hi! I'm processing a large number of xml files that are all declared as utf-8
encoded in the header ie.
My Python environment has been set for 'utf-8' through site.py. Additionally,
the top of each program/module has the declaration:
# -*- coding: utf-8 -*-
But, I still get this error:
Tr
t already being processed as utf-8?
Dinesh
From: Dinesh B Vadhia
Sent: Thursday, June 04, 2009 6:47 AM
To: tutor@python.org
Subject: unicode, utf-8 problem again
Hi! I'm processing a large number of xml files that are all declared as utf-8
encoded in the header ie.
My Python envir
Okay, I get it now ... reading/writing files with the codecs module and the
'utf-8' option fixes it. Thanks!
From: Christian Witts
Sent: Thursday, June 04, 2009 7:05 AM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] unicode, utf-8 problem again
Dinesh B Va
That was very useful - thanks! Hopefully, I'm "all Unicode" now.
From: wesley chun
Sent: Thursday, June 04, 2009 10:45 AM
To: Dinesh B Vadhia ; tutor@python.org
Subject: Re: [Tutor] unicode, utf-8 problem again
>> But, I still get this error:
>> Trace
I want to pickle (very long) strings and save them in a sqlite db. The plan is
to use pickle dumps() to turn a string into a pickle object and store it in
sqlite. After reading the string back from the sqlite db, use pickle loads()
to turn back into original string.
- Is this a good approac
Hi Vince
That's terrific! Once a string is compressed with gzip.zlib does it make a
difference whether it is stored it in a TEXT or BLOB column?
Dinesh
From: vince spicer
Sent: Wednesday, June 24, 2009 10:49 AM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] s
ling and sqlite blob'ing
Message-ID:
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
"Dinesh B Vadhia" wrote
> I want to pickle (very long) strings and save them in a sqlite db.
Why?
Why not just store the string in the dat
Say, you create an array['i'] for signed integers (which take a minimum 2
bytes). A calculation results in an integer that is larger than the range of
an 'i'. Normally, Python will convert an 'i' to a 4-byte 'l' integer. But,
does the same apply for an array ie. does Python dynamically adjust
I'm suffering from brain failure (or most likely just being brain less!) and
need help to create a list comprehension for this problem:
d is a list of integers: d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11, 1, 6, 3,
5, 6, 11, 1]
Want to create a new list that adds the current number and the pri
=flowed
On 7/3/2009 12:09 PM Dinesh B Vadhia said...
> I'm suffering from brain failure (or most likely just being brain less!)
> and need help to create a list comprehension for this problem:
>
> d is a list of integers: d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11,
>
y += x
>>>dd.append(y)
As the lists of integers get larger (mine are in the thousands of integers per
list) the list comprehension solution will get slower. Do you agree?
Dinesh
From: Kent Johnson
Sent: Friday, July 03, 2009 1:21 PM
To: Dinesh B Vadhia
Cc: tutor@python.o
This was discussed in a previous post but I didn't see a solution. Say, you
have
for i in veryLongListOfStringValues:
s += i
As per previous post
(http://thread.gmane.org/gmane.comp.python.tutor/54029/focus=54139), (quoting
verbatim) "... the following happens inside the python interpret
join with generator expression is what was needed. terrific!
From: Rich Lovely
Sent: Friday, July 17, 2009 4:19 PM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] large strings and garbage collection
2009/7/17 Dinesh B Vadhia :
> This was discussed in a previous post bu
During recent program testing, I ran a few Python programs from a Windows XP
batch file which causes a memory error for one of the programs. If I run the
same set of programs from the Python interpreter no memory error occurs. Any
idea why this might be?
Dinesh
___
before and it seems odd behavior.
Dinesh
From: Jeff Johnson
Sent: Saturday, July 18, 2009 3:24 PM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] python interpreter vs bat file
Need more information. Python works on Windows as good as anything
else. Maybe even better.
Dine
Date: Sun, 19 Jul 2009 07:18:08 +0100
From: "Alan Gauld"
To: tutor@python.org
Subject: Re: [Tutor] python interpreter vs bat file
Message-ID:
Content-Type: text/plain; format=flowed; charset="Windows-1252";
reply-type=original
"Dinesh B Vadhia" wrote
> No
gt;
Content-Type: text/plain; charset=us-ascii
On Sun, Jul 19, 2009 at 05:40:41AM -0700, Dinesh B Vadhia wrote:
>
>1. Run Python Programs with Batch file
>
>Python programs run from a Windows XP batch file (test.bat) in a CMD
>window initiated from Windows Exp
inesh
Message: 1
Date: Sun, 19 Jul 2009 23:22:47 +0100
From: "Alan Gauld"
To: tutor@python.org
Subject: Re: [Tutor] python interpreter vs bat file
Message-ID:
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
Hello! Anyone know of any example/cookbook code for implementing inverted
indexes?
Cheers
Dinesh
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Original Message -----
From: Kent Johnson
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Wednesday, October 31, 2007 7:48 AM
Subject: Re: [Tutor] Inverted Index
Dinesh B Vadhia wrote:
> Hello! Anyone know of any example/cookbook code for implementing
> inverted indexes?
Can you say m
A NumPy matrix (because we have to perform a dot matrix multiplication prior to
creating an inverted index).
Thank-you!
- Original Message -
From: Kent Johnson
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Wednesday, October 31, 2007 8:16 AM
Subject: Re: [Tutor] Inverted Index
Hello! I'm creating a dictionary called keywords that has multiple entries
each with a variable list of values eg.
keywords[1] = [1, 4, 6, 3]
keywords[2] = [67,2]
keywords[3] = [2, 8, 5, 66, 3, 23]
etc.
The keys and respective values (both are integers) are read in from a file.
For each key,
I'm sorting a 1-d (NumPy) matrix array (a) and wanting the index results (b).
This is what I have:
b = a.argsort(0)
b = b+1
The one (1) is added to b so that there isn't a zero index element. Is there a
more elegant way to do this?
Dinesh
___
Tutor
Hello! The standard Python practice for importing modules is, for example:
import sys
import os
etc.
In NumPy (and SciPy) the 'book' suggests using:
from numpy import *
from scipy import *
However, when I instead use 'import numpy' it causes all sorts of errors in my
existing code.
What do y
e
to be scipy objects or can they be numpy objects?
Dinesh
- Original Message -
From: Michael H. Goldwasser
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Wednesday, November 07, 2007 5:37 PM
Subject: [Tutor] From Numpy Import *
On Wednesday November 7, 2007, Dinesh B Vadhia
Consider a data structure (say, an array) that is operated on by a bunch of
functions eg.
def function_A
global array_G
do stuff with array_G
return
def function_B
global array_G
do stuff with array_G
return
def function_C
global array_G
do stuff with array_G
tor] global is bad but ...
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote
> Consider a data structure (say, an array) that is ope
Kent et al
I reworked the code to pass parameters (mainly arrays) to the functions. It
works and performs faster. Thank-you all very much for the insights.
Dinesh
- Original Message -
From: Kent Johnson
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Wednesday, November 14, 2007
Hi! I want to create (for testing purposes) a straightforward web application
consisting of a client that makes simple queries to a backend which returns
data from a database (initially pysqlite3). That's it - really! I don't need
a professional web server (eg. Apache) per se.
Are the Pytho
Hello! Can anyone see what the problem with this code snippet is?
Dinesh
image_filename = str(dir_list[i])
image_file = dir_path + image_filename
image_blob = open(image_file, '
Yes, it should be: image_blob = open(image_file, 'rb').read()
Thank-you!
- Original Message -
From: bob gailer
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Saturday, November 24, 2007 5:55 PM
Subject: Re: [Tutor] error binding parameter 1
Dinesh B Vadhia wrote:
>
I want to display a fixed number of same-size (jpeg) images on a web page. The
images displayed will change on user input.
I can use PIL to write the code but has anyone come across open source code
that already does this? Thank-you
Dinesh___
Tutor
For some significant data pre-processing we have to perform the following
simple process:
Is the integer x in a list of 13K sorted integers. That's it except this has
to be done >100m times with different x's (multiple times). Yep, a real pain!
I've put the 13K integers in a list S and am u
I used the s.intersection(t) function in the set type as it was the most
appropriate. The performance was phenomenal. Thank-you!
Dinesh
- Original Message -
From: bob gailer
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Tuesday, January 15, 2008 2:03 PM
Subject: Re: [Tutor] A
After a matrix*vector multiplication (ie. b = Ax, with A, x and b all floats),
the b vector elements are all "-1.#IND". What does this mean? Btw, they are
no divisions in the program eg. no divide by zeros.
Dinesh
___
Tutor maillist - Tutor@python
atrix multiplication, the b vector elements are all "-1.#IND" 's.
Note that there are no divisions by zero in the program.
Cheers
Dinesh
- Original Message -
From: Luke Paireepinart
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Saturday, January 26, 2008 11:12 PM
I've posted this on the Scipy forum but maybe there are answers on Tutor too.
I'm performing a standard Scipy matrix* vector multiplication, b=Ax , (but not
using the sparse module) with different sizes of A as follows:
Assuming 8 bytes per float, then:
1. matrix A with M=10,000 and N=15,000
I know this isn't the right forum to ask but I'll try as someone might know.
For my web application, I need a list box with a search capability. An example
is the Python documentation (hit the F1 key under Windows from IDLE) and
specifically the Index list ie. context-sensitive search through a
Has anyone come across Python modules/libraries to perform "Bag of Words" text
analysis or an interface to the libbow C library? Thank-you!
Dinesh
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
age-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Dinesh B Vadhia schrieb:
Hi,
| Has anyone come across Python modules/libraries to perform "Bag of
| Words" text analysis or an interface to the li
I've avoided it as long as possible but I've reached a stage where I have to
start using Python objects! The primary reason is that the web framework uses
objects and the second is to eliminate a few globals. Here is example pseudo
code followed by the question (one of many I suspect!):
class
Alan/Greg
I've combined your code fragments and added a function call too, to determine
how 'a' is passed between objects and classes:
def addNumbers(i, j):
k = i + j
return k
class A:
def oneA(self):
z = 2
self.a = self.a * z
class B:
def oneB(self):
in
Say because of performance, you might want to re-write/convert Python code to
C++. What is the best way (or best practice) to do this wrt the tools
available?
Dinesh
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Gauld" <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Python to C++
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote
> Say because
I spent fruitless hours trying to get a (normal) division x/y to work and then
saw that you have to declare:
> from __future__ import division
.. at the top of a module file. What is this all about?
Dinesh
___
Tutor maillist - Tutor@python.org
htt
Hi! Google announced an app server that allows pure Python developed
applications/services to use their infrastructure. This maybe of use to many
on this list. Further details can be found at: http://appengine.google.com/
The SDK include a modified Python 2.5.2 and Django 0.96.1, WebOb 0.9 a
Here is a for loop operating on a list of string items:
data = ["string 1", "string 2", "string 3", "string 4", "string 5", "string 6",
"string 7", "string 8", "string 9", "string 10", "string 11"]
result = ""
for item in data:
result = item + "\n"
print result
I want to replace the for loo
he result is printed (in fact, the result is sent from the server to
a browser one result line at a time)
The for loop will be called continuously and this is another reason to look for
a potentially better structure preferably a built-in.
Hope this makes sense! Thank-you.
Dinesh
- Origina
ed sensible that replacing the for loop with a built-in would help. Maybe
not?
Hope that helps.
Dinesh
- Original Message -
From: Kent Johnson
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Wednesday, April 09, 2008 1:48 PM
Subject: Re: [Tutor] List comprehensions
Dinesh B Vadhia wr
mance (and it has!). I'll try the binary search and let you
know. I'll also look at the trie structure.
An alternative is to create an in-memory SQLite database of the string items.
Any thoughts on that?
Dinesh
- Original Message -
From: Kent Johnson
To: Dinesh B Vadhia
Cc: t
Ignore the 'adjacent items' remark. The rest is correct ie. looking for all
strings containing a substring x.
- Original Message -
From: Kent Johnson
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Thursday, April 10, 2008 6:32 AM
Subject: Re: [Tutor] Searching through la
I'm reading a text file into an in-memory pysqlite table. When I do a SELECT
on the table, I get a 'u' in front of each returned row eg.
> (u'QB VII',)
> (u'Quackser Fortune Has a Cousin in the Bronx',)
I've checked the data being INSERT'ed into the table and it has no 'u'.
The second problem
'$q%', '%q%', '%q' and 'q%' and none
of them return what I expect ie. all strings with the characters "dog" in them.
Cheers!
Dinesh
- Original Message -
From: Dinesh B Vadhia
To: tutor@python.org
Sent: Thursday, April 10, 2008 3:24 P
Okay, I've got this now:
> con = sqlite3.connect(":memory:")
> cur = con.cursor()
> cur.execute("""CREATE TABLE db.table(col.a integer, col.b text)""")
> con.executemany("""INSERT INTO db.table(col.a, col.b) VALUES (?, ?)""", m)
> con.commit()
> for row in con.execute("""SELECT col.a, col.b FROM
I belong to the Old School where getting my head around OO is just one big
pain. I write software by modularization executed as a set of functions - and
it works (some call this functional programming!). Whenever I review Python
books (eg. Lutz's excellent Programming Python, 3ed) the code is
I'm using a pysqlite select statement within a def function and it's not
working because (I suspect) the pysqlite variables are not being declared
corrrectly to be used within a def function or the def function is not setup
correctly. Here is the code followed by the errors:
code
co
OTECTED]>
Subject: Re: [Tutor] SQLite LIKE question
Cc: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Dinesh B Vadhia wrote:
> Okay, I've got this now:
>
>> con = sqlite3.connect(":memory:")
>> c
Say, you have already created a pysqlite database "testDB". In a Python
program, you connect to the database as:
> con = sqlite3.connect("testDB")
> cur = con.cursor()
To use a database in memory (ie. all the 'testDB' tables are held in memory)
the pysqlite documentation says the declaration i
is that it
cannot find the database table. After reading your note, it hit me that an
execution thread is created by pysqlite and another thread by webpy and hence
webpy is not seeing the table. What a pain!
Dinesh
- Original Message -
From: bob gailer
To: Dinesh B Vadhia
Cc: tutor@
3:30 +0100
From: "Alan Gauld" <[EMAIL PROTECTED]>
Subject: Re: [Tutor] in-memory pysqlite databases
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; charset="Windows-1252";
reply-type=original
"Dinesh B Vadhia&q
Alan
Your last paragraph is the gist of my note ie. it's the documentation,
documentation, documentation.
In addition to Python, we use Numpy/Scipy/webpy at the server - all of them
Python libraries written in Python and/or C - and have faced no end of problems
with these libraries.
We also u
Here is a program that SELECT's from a pysqlite database table and encode's the
returned unicode strings:
import sys
import os
import sqlite3
con = sqlite3.connect("testDB.db")
cur = con.cursor()
a = u'99 Cycling Swords'
b = a.encode('utf-8')
print b
q = '%wor%'
limit = 25
query = "SELECT fiel
x27;,
what='fieldB',
where='fieldB LIKE $q',
limit=limit,
vars={'q':q}):
r = row['fieldB']# get encode'd unicode through
dict key value
print r # works perfec
Hi! Does anyone on this list have experience of using the Scipy Sparse matrix
library for loading and using very large datasets (>20,000 rows x >1m columns
of integers) under Windows?
I'm using a recent Scipy svn that supports (sparse) integer matrices but it
still causes the pythonw.exe progr
Is there an equivalent to the C/C++ 'case' (or 'switch') statement in Python?
Dinesh
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
The dictionary of functions was the way to go and does perform much faster than
if/elif's. Thank-you!
- Original Message -
From: inhahe
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Thursday, May 22, 2008 4:15 PM
Subject: Re: [Tutor] Equivalent 'case' statement
A text document has special character strings defined as "." + "set of
characters" + ".". For example, ".sup." or ".quadbond." or ".degree." etc.
The length of the characters between the opening "." and closing "." is
variable.
Assuming that you don't know beforehand all possible special char
Thank-you Kent - it works a treat!
- Original Message -
From: Kent Johnson
To: Dinesh B Vadhia
Cc: tutor@python.org
Sent: Sunday, June 01, 2008 4:25 AM
Subject: Re: [Tutor] finding special character string
On Sun, Jun 1, 2008 at 6:48 AM, Dinesh B Vadhia
<[EMAIL PROTECTED]>
Yes, I'm happy because I found a non-regex way to solve the problem (see below).
No, I'm not a student or worn out but wish I was back at college and partying!
Yes, this is an interesting problem and here is the requirement:
- A text document contains special words that start and end with a peri
Does the Python zipfile module work on rar archives? If not, does a similar
module exist for rar archives?
Dinesh
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
the zipfile module does work or rar zip archives.
- Original Message -
From: Dinesh B Vadhia
To: tutor@python.org
Sent: Saturday, June 07, 2008 8:27 AM
Subject: zip and rar files
Does the Python zipfile module work on rar archives? If not, does a similar
module exist for rar
I want to extract text from XML (and SGML) documents. I found one program by
Paul Prescod (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65128)
from 2001. Does anyone know of any programs that are more recent? Cheers
Dinesh
___
Tutor maill
I have a program with 2 for loops like this (in pseudocode):
fw = open(newLine.txt, 'w')
for i in xrange(0, 700,000, 1):
read a file fname from folder
for line in open(fname, 'r'):
do some simple string processing on line
fw.write(newline)
fw.close()
That's it. Very simpl
There is no thrashing of disk as I have > 2gb RAM and I'm not keeping the file
contents in memory. One line is read at a time, some simple string processing
and then writing out the modified line.
From: Kent Johnson
Sent: Sunday, June 22, 2008 5:39 PM
To: Dinesh B Vadhia
C
I want to remove whole numbers from text but retain numbers attached to words.
All whole numbers to be removed have a leading and trailing space.
For example, in "the cow jumped-20 feet high30er than the lazy 20 timing fox
who couldn't keep up the 865 meter race." remove the whole numbers 20 an
Hi! Say, I've got a numpy array/matrix of the form:
[[1 6 1 2 3]
[4 5 4 7 0]
[2 0 8 0 2]
[8 2 6 3 0]
[0 7 0 3 5]
[8 0 3 0 6]
[8 0 0 2 2]
[3 1 0 4 0]
[5 0 8 0 0]
[2 1 0 5 6]]
And, I want to create a dictionary of rows (as the keys) mapped to lists of
non-zero numbers in that row ie.
di
help.
Dinesh
Message: 5
Date: Sun, 21 Sep 2008 09:15:00 +0100
From: "Alan Gauld" <[EMAIL PROTECTED]>
Subject: Re: [Tutor] array and dictionary
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
r
1 - 100 of 129 matches
Mail list logo