being too obsessive about this, but
that didn't stop me from posting. Comments?
--
http://mail.python.org/mailman/listinfo/python-list
Groovy allows spaces in method names. See following request and thread:
http://jira.codehaus.org/browse/GROOVY-2857
--
Kam-Hung Soh http://kamhungso
Vista and ActiveState Python 2.5.1.1.
import SendKeys
SendKeys.SendKeys("""^c""")
Thank you!
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
Chris wrote:
On Jun 6, 5:13 am, Kam-Hung Soh <[EMAIL PROTECTED]> wrote:
Tim Roberts wrote:
DataSmash <[EMAIL PROTECTED]> wrote:
I have a text file that contains thousands of lines and each line is
256 characters long.
This is my task:
For each line in the file, move to the 25th c
27;outputfile.txt','w')
for line in open('inputfile.txt'):
if line[24] == 'T':
fout.write( line[34:39] + ',' )
Should the last line be ...
fout.write(','.join(line[34:39])
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
st=ns.GetDetailsOf(i, c)
if artist:
print ns.GetDetailsOf(i, 0), artist
break
Roger
I shall give that a go. (is the module you reference this one?
http://python.net/crew/mhammond/win32/Downloads.html )
If you installed ActiveState's Python, the win3
reak
Roger
Great tip, Roger! This solution works for WMA files (I don't have any
MP3 files handy), so I think it would work for any media files in Windows.
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
3.00")
HTH
Matthias
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the tip, Matthias. I knew that there had to be a way to
handle arbitrary precision numbers.
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
) for cell in row]
['Date', 'No.', 'Description', 'Debit', 'Credit']
['3/17/2006', 5678, 'ELECTRONIC PAYMENT', '', 11.449]
['3/04/2007', 5678, 'THE HOME DEPOT 263 SomeCity FL', '',
25.399]
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
See:
http://www.python.org/doc/2.4/whatsnew/whatsnew24.html
Dunno of a general way view a list of features versus releases, other
than reading the "What's New in Python x" documents. Maybe some
enterprising developer can compile this list? Hint, hint.
--
Kam-Hung Soh http://kamhu
an
connect a pipe to that command. Maybe look at "subprocess -- Subprocess
management" in http://docs.python.org/lib/module-subprocess.html
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
y scripting new features.
- Interface between databases, Excel and text files.
- Convert data between flat files and XML.
- Manage files for build processes.
- Automating processes (e.g. checkout, builds, FTP).
Wish I had some reasons to make a GUI application in Python.
--
Kam-Hung Soh http://kam
roceed .
Thanks a lot
1. Test with a small number of short files with a clear idea of the
expected result.
2. Use better variable names. Names such as file1_search, file2_search,
gi, gi2, A, B, C and D make it nearly impossible to understand your code.
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
le:
s1 = set([1,2,3])
s2 = set([3,4,5])
s1 & s2
set([3])
You can populate your sets using an iterable, such as the lines from a
file. Example:
s1 = set(file(r'blah.txt'))
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 15 May 2008 12:36:29 +1000, Collin <[EMAIL PROTECTED]> wrote:
Kam-Hung Soh wrote:
On Wed, 14 May 2008 11:02:36 +1000, Collin <[EMAIL PROTECTED]> wrote:
Gabriel Genellina wrote:
En Mon, 12 May 2008 01:54:28 -0300, Collin <[EMAIL PROTECTED]>
escribió:
Collin wro
-list
You don't need to import any module to use ".lower()"; it is a method of a
string. raw_input() returns a string, so you can use methods of a string.
Try the following statement to see what happens:
"ABCDE".lower()
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
)
l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
l[:4] # first four elements
[0, 1, 2, 3]
l[::2] # every second element
[0, 2, 4, 6, 8]
l[:4:2] # every second element in the first four elements
[0, 2]
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
sliding window?
See http://www.gnu.org/software/sed/manual/sed.html, Section 4.13
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
o test your faith.
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
eading indentation marks such as "> " before you paste sample code into
your IDE:
getclip | sed "s/> //" | putclip
See http://kamhungsoh.com/blog/2008/05/more-uses-of-getclip-putclip.html
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 10 May 2008 18:06:17 +1000, Arnaud Delobelle
<[EMAIL PROTECTED]> wrote:
"Kam-Hung Soh" <[EMAIL PROTECTED]> writes:
On Sat, 10 May 2008 07:19:38 +1000, <[EMAIL PROTECTED]> wrote:
> What would be the best method to print the top results, the one's
ot;FizzBuzz") or (not x%3 and "Fizz")
or (not x%5 and "Buzz") or x, xrange(1,101))
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
last three items:
sorted((len(anagrams[key]), key) for key in anagrams.keys())[-3:]
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
I found the other tips in parallel responses useful
to me too!
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
.sort()
sortedword = (''.join(word))
if sortedword in mapdic:
print line
On 2008-05-07 19:25:53 -0600, "Kam-Hung Soh" <[EMAIL PROTECTED]>
said:
On Thu, 08 May 2008 11:02:12 +1000, dave <[EMAIL PROTECTED]>
ave the letters 'a', 'd', 'e' and 'm'.
Refer "Programming Pearls" by Jon Bentley.
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 07 May 2008 09:09:08 +1000, Kam-Hung Soh <[EMAIL PROTECTED]>
wrote:
On Wed, 07 May 2008 08:36:35 +1000, Michael Robertson
<[EMAIL PROTECTED]> wrote:
I'm having trouble opening a file in linux, whose path has spaces in it.
$ mkdir my\ test
$ echo test > my\ te
7;)
>>> open('./test')
works just fine.
Couldn't test on Linux, but in Windows ...
os.chdir('C:\temp\my test')
Traceback (most recent call last):
File "", line 1, in
WindowsError: [Error 123] The filename, directory name, or volume label
synt
ot
inconsistent.
> How do I convert that line into a list?
Use the `csv` module in the standard library.
Ciao,
Marc 'BlackJack' Rintsch
Hello Marc;
Thanks for the input! I am worried about the comma in the "" data
items, how do I tell Python to look for the "&quo
On Wed, 30 Apr 2008 17:12:15 +1000, Kam-Hung Soh <[EMAIL PROTECTED]>
wrote:
On Wed, 30 Apr 2008 15:27:36 +1000, Raymond <[EMAIL PROTECTED]>
wrote:
For some reason I'm unable to grok Python's string.replace() function.
Just trying to parse a simple IP address, wrap
regular expressions.
Try:
import re
p = re.compile("^.*\[")
q = re.compile("].*$")
q.sub('',p.sub('', line))
Is there a decent description of string.replace() somewhere?
Raymond
Section 3.6.1 String Functions
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 30 Apr 2008 16:13:17 +1000, SL <[EMAIL PROTECTED]> wrote:
How can I compute with the integer values of characters in python?
Like 'a' + 1 equals 'b' etc
Try: ord('a')
See also: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65117
--
Kam
.1 "String literals".
Could there be some files in that directory whose name is not a valid
Windows file name? Windows file names cannot have the following symbols:
\ / : * ? " < > |
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
rian Vanderburg II
No worries. People should (I hope) just ignore the sender address when
they receive spam.
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
estring', 1, 2], ['oneother', 2, 4]]
> for alist in someList:
> if alist[0] == 'somestring':
> print "Found it at index %d" % someList.index( alist )
> # if you know it will only occur once you might say:
> break
>
> HTH,
ill file variable (use Firefox
about:config and filter for "kill") and enable case-insensitive search
(open the script, search for "compile()" and add a second parameter
"i").
(Posted via GG, but I'm open to an alternative web-based Usenet
service.)
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
t;
> > how to remove \n from the given list
>
> l is is very poor name... I'll use lines instead:
>
> lines[:] = [line.rstrip('\n') for line in lines]
>
> --
> Gabriel Genellina
Also: map(str.rstrip, l)
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
ge Python written in 100% Pure Java, and seamlessly
integrated with the Java platform. It thus allows you to run Python on
any Java platform."
--
Kam-Hung Soh http://kamhungsoh.com/blog";>Software Salariman
--
http://mail.python.org/mailman/listinfo/python-list
37 matches
Mail list logo