473,787 Members | 2,938 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python Forum

Python programming language - Ask questions about python interpreter, control flow, data structures, modules errors, classes, standard library, gui, databases, unit testing, object oriented, structured programming and more.
5
1,440
thread by: TheSeeker | last post Oct 23 '07 by: Raymond Hettinger
Hi, I have run into something I would like to do, but am not sure how to code it up. I would like to perform 'set-like' operations (union, intersection, etc) on a set of objects, but have the set operations based on an attribute of the object, rather than the whole object. For instance, say I have (pseudo-code): LoTuples1 =
4
3,057
thread by: beginner | last post Oct 23 '07 by: beginner
Hi All, If I have a list comprehension: ab= c = "ABC" print c
2
1,708
thread by: msteinore | last post Oct 23 '07 by: elcron
I want to write a generic function that calls other functions and does some additional pre and post processing. Example calls: genericfn(function=max,a=3,b=4) would call max(a=3,b=4) and return 4 genericfn(function=average,a=4,c=8) would call average(a=4,c=8) and return 6, assuming parameter b in fn average defaults to 6 It should...
5
2,676
thread by: =?UTF-8?B?UmFmYcWC?= Zawadzki | last post Oct 23 '07 by: Gabriel Genellina
Hello. As I saw in logging source - there is no lock per file during making emit() (only lock per thread). So, my question is - is it safe to log into one file using many processess uses logging logger? Cheers, --
1
3,402
thread by: mrstephengross | last post Oct 23 '07 by: Marc 'BlackJack' Rintsch
I've got a Base class with an attribute "foo" (of type Foo), and a Derived class (derived from Base). In Derived's constructor, I try to refer to Base.foo, but python complains: AttributeError: class Base has no attribute 'foo' Any ideas? (code below) === CODE === #!/usr/bin/python
4
2,293
thread by: arunasunil | last post Oct 23 '07 by: arunasunil
Hi, Is there a way to track external processes launched by python on the Mac? I am using subprocess module to launch the process. Thanks Sunil
9
4,285
thread by: Peter Bengtsson | last post Oct 23 '07 by: Roberto Bonvallet
In UTF8, \u0141 is a capital L with a little dash through it as can be seen in this image: http://static.peterbe.com/lukasz.png I tried this: '' I was hoping it would convert it it 'L' because that's what it visually looks like. And I've seen it becoming a normal ascii L before in other programs such as Thunderbird.
2
2,333
thread by: Shawn Minisall | last post Oct 23 '07 by: Marc 'BlackJack' Rintsch
I just wrote a program to let the user input a series of whole numbers and tell them which is least and which is greatest based off of a menu. However, the menu isn't kicking in after they pick a number. I included a while statement for a loop just for the menu and compared it to my other programs that have a similar setup and are working,...
2
2,011
thread by: Rene Maurer | last post Oct 23 '07 by: Rene Maurer
Hallo I wonder if there are any pure python implementations available/known for the zip (or any other) data compression... As far as I know python's zlib uses http://www.zlib.net/, which is written in C. Unfortunately this is not solution for me, because my target "only" has a python interpreter.... I have "googled" for a while, but I...
0
803
thread by: Edward K Ream | last post Oct 23 '07 by: Edward K Ream
Leo 4.4.4 beta 3 is available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 Leo 4.4.4 contains many important features originally planned for later releases. It's been a good month :-) Leo is a text editor, data organizer, project manager and much more. See:...
9
21,610
Thekid
thread by: Thekid | last post Oct 23 '07 by: Thekid
How do you go about converting something to ASCII using python? I have an example below of some randomly generated text that would need converted: 96,114,101,106,60, Shift: 27 I don't know where to begin with this....
4
1,213
thread by: Abandoned | last post Oct 23 '07 by: Abandoned
Hi.. I want to do a forum with python but i have a problem.. I have a <textareaand i write: line 1 hi line 2 how r u And then i save to this database ( colomn data type is text) And than it looks "line 1 hi line 2 how r u".. How can i protect \n characters ?
1
2,568
thread by: Otacon22 | last post Oct 23 '07 by: Paul Boddie
Hi all, I want to create a robot with a router board based on processor atheros 2.6, called "fonera". I have installed a version of linux, Openwrt and python and i want to use it for some reasons, but i have problems to have access to GPIO pins on the board to read and write on harware(pic, memories...) so i want to include into python a...
0
1,393
thread by: Papalagi Pakeha | last post Oct 23 '07 by: Papalagi Pakeha
Hi all, I'm trying to do some calculations with NumPy but apparently didn't quite got the basics. For example I need Exponential Moving Average function. That is, I have an array of values and want to apply a function F(current, previous) to each element of the array. How can I pass the 'previous' element to the function? In plain python it...
5
1,227
thread by: Yinghe Chen | last post Oct 23 '07 by: Loic Mahe
Hello gurus, I have a question, a function like below, it is implemented by me, :) def funcA(tarray): a = if len(tarray) >=3: return a,a, a elif len(tarray) == 2: return a,a, funcB(1)
3
3,033
thread by: =?ISO-8859-1?Q?Fabian_L=F3pez?= | last post Oct 23 '07 by: limodou
Hi, I am parsing an XML file that includes chineses characters, like ^ uuࢲDZw.Lﳲǐ or إ... The problem is that I get an error like: UnicodeEncodeerror:'charmap' codec can't encode characters in position.... The thing is that I would like to ignore it and parse all the characters less these ones. So, could anyone...
0
777
thread by: scripteaze | last post Oct 23 '07 by: scripteaze
Trying to figure out how to add login verfication. I believe it is logging me in, but theres no way to really tell..any ideas? or tutorials out there that can exaplain this to me? Thanks import urllib,urllib2,cookielib passlst = open(passfile, 'r').readlines() url="http://somesite"
1
1,122
thread by: Travis Oliphant | last post Oct 23 '07 by: Paul Rubin
Hi all, I think the latest patch for fixing Issue 708374 (adding offset to mmap) should be committed to SVN. I will do it, if nobody opposes the plan. I think it is a very important addition and greatly increases the capability of the mmap module. Thanks,
0
1,623
thread by: David Michael Schruth, | last post Oct 23 '07 by: David Michael Schruth,
Hi, I am sort of in a jam here. I am using the PsycoPG2 library to read data out of a windows XP based PostGIS / PostGreSQL database but I am apparently unable to write (update or insert) even though I am able to read (select) I am using PsycoPG2 2.0.6 (psycopg2-2.0.6.win32-py2.5-pg8.2.4- release.exe ) with Python 2.5 (python-2.5.msi)
10
2,939
thread by: james_027 | last post Oct 22 '07 by: Steven D'Aprano
hi, i have a function that I could like to call, but to make it more dynamic I am constructing a string first that could equivalent to the name of the function I wish to call. how could I do that? the string could might include name of the module. for example a_string = 'datetime.' + 'today()'
8
3,636
thread by: stef mientki | last post Oct 22 '07 by: Mike Orr
hello, I've written a convenience wrapper around ConfigObj (which is a imporved ConfigParser). Now if I use an instance of the base class, I can easily test is the instance exists by " if ini:", like in this example ini = None
3
1,362
thread by: Stefan Bellon | last post Oct 22 '07 by: =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
Hi, I'm trying to build a Sun Solaris Version of Python from the source so that both, 32-bit and 64-bit libraries are present. I can successfully build a 32-bit version in one directory and a 64-bit version in another directory. What I'd like to do is to build a version that has the 64-bit library in a sparcv9 directory but shares the...
7
2,462
thread by: sami | last post Oct 22 '07 by: sami
Hi I am trying to write a facebook application in python - I have been programming simple desktop applications till now and am not really familiar with web apps Pyfacebook is the wrapper for the REST based Facebook API - there is a simple example for its usage as shown below: def simple_web_app(request, api_key, secret_key):
1
1,345
thread by: Gabriel Genellina | last post Oct 22 '07 by: Steven Bethard
QOTW: "here's always no best." - Lawrence Oluyede http://groups.google.com/group/comp.lang.python/msg/32bce47d185 ce42e "I actually do a lot of unit testing. I find it both annoying and highly necessary and useful." - Steven Bethard http://groups.google.com/group/comp.lang.python/msg/4df60bdff72540cb Some confusion when using `if x:`...
1
1,331
thread by: Gerard Brunick | last post Oct 22 '07 by: Daniel Lenski
Is there a way to do: s = "I like python %i%s of the time." print s % (99, "%") without having to pass in "%"? Thanks, Gerard

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.