In a program I'm writing I have a problem where a bit of text sent over
a network arrives at my server. If the person who sent the text made a
mistake typing the word and pressed backspace the backspace code is
included in the word for example hello is hel\x08lo. The \x08 is the
backspace key. How
On Jan 4, 6:24 am, Ramashish Baranwal <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I am trying to read a csv file using csv.reader. The file is created
> using Open Office and saved in Excel format.
>
> import csv
>
> reader = csv.reader(open('test.xls'))
> for row in reader:
> print row
>
> It however
On Jan 4, 5:11 am, Carsten Haese <[EMAIL PROTECTED]> wrote:
> On Thu, 2008-01-03 at 17:25 -0800, t_rectenwald wrote:
> > On Jan 3, 7:47 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
> > > I have a python script that uses the cx_Oracle module. I have a list
> > > of values that I iterate through via
On Jan 4, 3:45 pm, Mike <[EMAIL PROTECTED]> wrote:
> I'm not sure if this is a bug or if I'm just not understanding
> something correctly. I'm running the following (broken.py) on
> ActivePython 2.5.1.1, based on Python 2.5.1 (r251:54863 5/1/2007) as
> "python broken.py foo" (on Windows, of course
On Jan 4, 3:57 pm, wanzathe <[EMAIL PROTECTED]> wrote:
> hi everyone
> i'm a newbie to python :)
> i have a binary file named test.dat including 960 records.
> the record format is int a + int b + int c + int d
> i want to build a dict like this: key=int a,int b values=int c,int d
> i choose u
On Jan 4, 4:32 pm, Carsten Haese <[EMAIL PROTECTED]> wrote:
> On Fri, 2008-01-04 at 00:03 -0800, Chris wrote:
> > You should bind all variables to save the pool.
>
> > cursor = connection.cursor()
> > cursor.executemany("""insert into as_siebel_hosts_
On Jan 8, 1:03 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> BJ Swope wrote:
> > given a list such as
>
> > ['messages', 'recipients', 'viruses']
>
> > how would I iterate over the list and use the values as variables and
> > open the variable names a files?
>
> > I tried
>
> > for outfile in ['me
On Jan 11, 10:30 am, Tom_chicollegeboy <[EMAIL PROTECTED]> wrote:
> here is what I have to do:
>
> This question involves a game with teddy bears. The game starts when I
> give you some bears. You then start giving me back some bears, but you
> must follow these rules (where n is the number of bear
On Jan 9, 12:34 pm, cesco <[EMAIL PROTECTED]> wrote:
> Hi,
>
> say I have a string like the following:
> s1 = 'hi_cat_bye_dog'
> and I want to replace the even '_' with ':' and the odd '_' with ','
> so that I get a new string like the following:
> s2 = 'hi:cat,bye:dog'
> Is there a common recipe t
On Jan 11, 2:15 pm, cesco <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a file containing four columns of data separated by tabs (\t)
> and I'd like to read a specific column from it (say the third). Is
> there any simple way to do this in Python?
>
> I've found quite interesting the linecache module
On Jan 13, 4:14 pm, Lie <[EMAIL PROTECTED]> wrote:
> A built-in exceptions, when raised, would print traceback that points
> out the offending code, like this:
>
> Traceback (most recent call last):
> File "F:\dir\code.py", line 43, in
> a = 1/0 <<<---
> ZeroDivisionError: integer division o
On Jan 16, 7:59 am, "J. Peng" <[EMAIL PROTECTED]> wrote:
> On Jan 16, 2008 1:45 PM, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
>
> > On Wed, 16 Jan 2008 11:09:09 +0800, "J. Peng" <[EMAIL PROTECTED]>
>
> > alist = []
> > anint = 2
> > astr = "Touch me"
>
> > dummy(alist, anint, astr)
>
> >
On Jan 17, 2:35 pm, [EMAIL PROTECTED] wrote:
> On Jan 17, 1:21 pm, Sacred Heart <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
> > I'm new to Python and have come across a problem I don't know how to
> > solve, enter com.lang.python :)
>
> > I'm writing some small apps to learn the language, and I like i
On Jan 18, 7:55 am, "J. Peng" <[EMAIL PROTECTED]> wrote:
> hello,
>
> why this happened on my python?
>
> >>> a=3.9
> >>> a
>
> 3.8999
>
> I wanted 3.9 but got 3.89
> How to avoid it? thanks.
>
> this is my python version:
>
> >>> sys.version
>
> '2.3.4 (#1, Feb 6 2006,
cept IndexError:
print 'Not enough delimiters in line.'
try:
f2_col2 = file2_line.split(' ')[2]
except IndexError:
print 'Not enough delimiters in line.'
if f1_col2 != f2_col2:
outfile_data_to_relevant_files()
file1_line = file1.next()
file2_line = file2.next()
HTH
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 18, 12:08 pm, Madhur <[EMAIL PROTECTED]> wrote:
> On Jan 18, 2:37 pm, Chris <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jan 18, 11:23 am, Madhur <[EMAIL PROTECTED]> wrote:
>
> > > I would like to know the best way of generating filter of tw
On Feb 5, 7:05 pm, "Adam W." <[EMAIL PROTECTED]> wrote:
> Tried running IDEL from the command prompt to get this:
>
> Traceback (most recent call last):
> File "c:\Python25\Lib\idlelib\idle.pyw", line 21, in
> idlelib.PyShell.main()
> File "c:\Python25\lib\idlelib\PyShell.py", line 1404, i
On Feb 8, 11:29 am, John Deas <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I made a small script to recursively copy files from a directory tree
> to an exportDir only if they have an mp3 extension :
>
> a=os.walk(os.getcwd())
> for root, dirs, files in a:
> for currFile in files:
>
On Feb 10, 8:06 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi, I'm trying to write a for loop in place of the string
> method .replace() to replace a character within a string if it's
> found.
>
> So far, I've got
>
> s = raw_input("please enter a string: ")
> c = raw_input("please enter
On Feb 12, 10:25 pm, Santiago Romero <[EMAIL PROTECTED]> wrote:
> Hi...
>
> I'm trying to guess how to access attributes of an existing object
> given the attribute name in a string. I mean:
>
> class Object:
> self.x = 12
> self.y = 20
> self.name = "blah"
>
> def ChangeAttribute( o
On Feb 12, 9:38 pm, Dennis Kempin <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have a set of some objects. With these objects I want to call a Python
> method. But the writer of the method shall have the option to select
> from these objects as method parameter.
>
> At the moment i use the following w
On Feb 12, 12:21 pm, Mike P <[EMAIL PROTECTED]> wrote:
> I did just try to post, but it doesn't look like it has appeared?
>
> I've used your advice Andrew and tried to use the CSV module, but now
> it doesn't seem to pick up the startswith command?
> Is this because of the way the CSV module is re
On Feb 12, 3:45 pm, "Sun" <[EMAIL PROTECTED]> wrote:
> Maybe this is a very primative question, but I just get a bit confused about
> 'set' and 'Set' module in python.
>
> I understand 'set' is a build in type in python after 2.4(or 2.3) and Set a
> seperate module, anyhow, I gonna use build in 'se
On Feb 13, 11:20 am, "Juha S." <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to use the Python profilers to test my code, but I get the
> following output for cProfile.run() at the interpreter:
>
> Traceback (most recent call last):
> File "", line 1, in
> File "/usr/lib/python2.5/cProfile.p
On Feb 13, 2:22 pm, "WILLIAM SCHMIDT" <[EMAIL PROTECTED]> wrote:
> In several places in the Python documentation I have run across an extra "r"
> that I can not explain:
>
> *
> In sys.path after the open bracket:
>sys.path = [r'd:\temp']
>
> In the on line help
On Feb 13, 5:51 pm, azrael <[EMAIL PROTECTED]> wrote:
> I came across the fromfunc() function in numpy where you pass as an
> argument the name of a function as a string and also the atributes for
> the desired function.
>
> I find this extremly usefull and sexy. Can someone point me how write
> a
On Feb 13, 5:51 pm, azrael <[EMAIL PROTECTED]> wrote:
> I came across the fromfunc() function in numpy where you pass as an
> argument the name of a function as a string and also the atributes for
> the desired function.
>
> I find this extremly usefull and sexy. Can someone point me how write
> a
It doesn't like all that text in the previous one...
Just before s = '' you have 4 double quotes to close to doc-string
instead of 3.
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 13, 7:29 pm, "Bill Davy" <[EMAIL PROTECTED]> wrote:
> The following code produces an error message (using Idle with Py 2.4 and
> 2.5). "There's an error in your program: EOL while scanning single-quoted
> string". It comes just after "s = ''" (put there to try and isolate the
> broken stri
what would also be good? If you didn't expect people to read
> over 500 lines of code to find YOUR problem, because you can't be
> bothered to isolate the error.
>
> When you have a problem, send the SMALLEST piece of code the exhibits the
> problem, not the entire app
On Feb 14, 8:54 am, "W. Watson" <[EMAIL PROTECTED]> wrote:
> See Subject. It's a simple txt file, each line is a Python stmt, but I need
> up to four digits added to each line with a space between the number field
> and the text. Perhaps someone has already done this or there's a source on
> the we
On Feb 14, 1:29 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Feb 14, 6:13 pm, Chris <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Feb 14, 8:54 am, "W. Watson" <[EMAIL PROTECTED]> wrote:
>
> > > See Subject. It's a simple txt file, each l
On Feb 14, 7:21 pm, [EMAIL PROTECTED] wrote:
> Hi all,
>
> Is there any standard way to tell if the user is running from a module
> or from an interactive shell like IDLE or IPython? The best I've come
> up with so far is for a function to look at
> getouterframes(currentframe())[1][1] (the filenam
On Feb 15, 1:11 pm, Albert-jan Roskam <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a csv file with tab as a delimiter. I want to
> convert it into one that is comma delimited. I changed
> the regional settings on my computer to US.
>
> At first I thought I could use the CSV module for
> this, by
hose values as a variable.
> I also looked at os.statvfs(), but that output doesn't seem to make
> any sense at all to me, knowing the size of the disc.
> Thanks for your help!
> R.D.
import os, statvfs
s = os.statvfs(".")
freebytes = s[statvfs.F_BSIZE] * s[statvfs.F_BAVAIL]
HTH,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 19, 6:23 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> > Doesn't PostGres come with Export/Import apps ? That would be easiest
> > (and faster).
>
> Yes, you can use "pg_dump production ... | psql testdb", but
> this can lead to dead locks, if you call this during
> a python script which
On Feb 19, 5:06 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to copy data from a production database to
> a testing database. Up to now I used psycopg2 and
> copy_from and copy_to with two cursors and a temporary file.
>
> This works, but it would be better, if the data
> gets pi
On Feb 20, 3:42 am, richie <[EMAIL PROTECTED]> wrote:
> On Feb 20, 9:35 am, icarus <[EMAIL PROTECTED]> wrote:
>
>
>
> > > To the original poster what environment are you running this in?
>
> > Linux. Xubuntu if that matters.
>
> > > When I put your program in notepad and run it fro
On Feb 25, 11:15 am, [EMAIL PROTECTED] wrote:
> Hi,
> This is a basic problem, but I want to print help content in a Command
> Prompt in WinXP and scrolling back to see the first lines. If I start
> a command prompt and run python, and then for example,
>
> >>> help(list)
>
> it starts showing the
On Feb 25, 12:35 pm, robert <[EMAIL PROTECTED]> wrote:
> Somebody who uses my app gets a error :
>
> os.stat('/path/filename')
>
> OSError: [Errno 75] Value too large for defined data type:
> '/path/filename'
>
> on a big file >4GB
>
> ( Python 2.4.4 / Linux )
>
> How about that? Does Python not su
probably be fine, but I have no idea if they are "write
safe" (I have no experience with the underlying unix stuff). Any tips
appreciated.
Thanks,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 28, 7:47 am, "Brian Smith" <[EMAIL PROTECTED]> wrote:
> Chris wrote:
> > I need simple data persistence for a cgi application that
> > will be used potentially by multiple clients simultaneously.
> > So I need something that can handle locking among
On Mar 4, 7:12 am, "Mike Walker" <[EMAIL PROTECTED]> wrote:
> I am having some problems with command line arguments in Windows. The same
> code under Linux works fine.
>
> In Windows I only get one argument no matter how many arguments are passed
> on the command line. I think there is some problem
On Mar 4, 8:38 am, "Mike Walker" <[EMAIL PROTECTED]> wrote:
> > If you run a python file, ie. just double clicking it the only
> > argument you will have will be the filename of the script. If you
> > create a shortcut to the script and in the target box add your
> > arguments (if you have quotati
sume). I chmodded the db file to 666, but it did not
help.
Any ideas?
Thanks,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 4, 3:10 pm, chris <[EMAIL PROTECTED]> wrote:
> I am trying to execute an update to a sqlite3 db via a python cgi
> script. I can execute a select via a cgi script, but when I attempt
> an update, I get an "unable to open database file" error. But the
> error c
If all you wanted was some grouping of exceptions why not something
like...
soft_exception_list = [IndexError, TypeError]
hard_exception_list = [ZeroDivision]
try:
do_something()
except Exception, e:
if e.__class__ in soft_exception_list:
handle_soft_exception()
elif e.__class
On Mar 11, 5:44 am, Nathan Pinno <[EMAIL PROTECTED]> wrote:
> Why does my compiler say invalid syntax and then highlight the
> quotation marks in the following code:
>
> # This program is to find primes.
> primes = []
> import math
> import gmpy
> while 1:
> run = int(raw_input("Do you want to
On Mar 12, 12:32 pm, "k.i.n.g." <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I would like create files of different size, taking size as user
> input. I need to check the data transfer rates from one network to
> another . In order to do this I will have to create files of diff size
> and work out. I a
On Mar 12, 12:52 pm, Chris <[EMAIL PROTECTED]> wrote:
> On Mar 12, 12:32 pm, "k.i.n.g." <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > I would like create files of different size, taking size as user
> > input. I need to check the data transfer ra
On Mar 12, 8:10 pm, Casey T <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm new to Python and I'm having some problems with getting different
> results from my script when I run it from IDLE versus just double-
> clicking the .py file and having it run through the command line.
> Basically, my script read
On Mar 13, 8:21 am, [EMAIL PROTECTED] wrote:
> i've an XML file with the following structure
>
>
>
>
> .
> .
> .
> .
> .
>
>
>
> what i want to do is copy all data(tags and all) between N and N+k
> appearances of . I am a python newbie. How do I do it?
>
> Thanks.
You can take a look at t
On Mar 13, 9:36 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am surprised that it took me so long to bloody my nose on this one.
>
> It must be well known - and I would like to find out how well known.
>
> So here is a CLOSED BOOK multiple choice question - no RTFM,
> no playing
On Mar 14, 6:28 am, jai_python <[EMAIL PROTECTED]> wrote:
> hi frenz I Need a Python Script For read multiple files(.txt) from a
> folder and write it in a single text file
>
> Thanks
Take a look at the OS Module for the listdir funtion, you can use it
to build a list of all files in the give
On Mar 14, 8:36 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Thu, 13 Mar 2008 21:28:18 -0700 (PDT), jai_python
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
> > hi frenz I Need a Python Script For read multiple files(.txt) from a
> > folder and write it in a single
On Mar 18, 11:57 am, Simon Forman <[EMAIL PROTECTED]> wrote:
> Is there a more efficient way to do this?
>
> def f(L):
> '''Return a set of the items that occur more than once in L.'''
> L = list(L)
> for item in set(L):
> L.remove(item)
> return set(L)
>
> |>> f([0, 0, 1, 1
On Mar 20, 1:19 pm, igbt <[EMAIL PROTECTED]> wrote:
> I am creating a simple script which is using gtk. In this script you
> must enter a text, if you do not enter anything or you enter a dot,
> the script will be finished. However, if you don't enter anything the
> script works but if you enter a
On Feb 13, 10:02 am, redbaron wrote:
> > New to python I have a large file that I need to break up into
> > multiple smaller files. I need to break the large file into sections
> > where there are 65535 lines and then write those sections to seperate
> > files.
>
> If your lines are variable-l
On Feb 13, 1:19 pm, Chris wrote:
> On Feb 13, 10:02 am, redbaron wrote:
>
>
>
> > > New to python I have a large file that I need to break up into
> > > multiple smaller files. I need to break the large file into sections
> > > where there are 65535
On Feb 19, 12:24 am, Steve Holden wrote:
> Rudi Goldman wrote:
> > Hi,
> > Go easy on me as I am a new to Python and am trying to solve a practical
> > problem that is driving me bananas.
> > Basically I have 2 text files, a source and a target. I want to be able
> > to delete all of the lines in
On Dec 2, 3:01 am, alex23 <[EMAIL PROTECTED]> wrote:
> On Dec 2, 5:31 am, Aaron Scott <[EMAIL PROTECTED]> wrote:
>
> > I was using .index on the
> > list, but it would return True for strings that contained the search
> > string rather than match it exactly, leading to false positives in my
> > cod
>
> Just don't even think of passing --enable-shared to Python's configure,
> and it will all work fine, and you won't need to use ldconfig.
>
Well I've done --enable-shared so that I can compile mod_python as a
shared object within apache.
Created /etc/ld.so.conf.d/python2.5.conf on a redhat syste
On Nov 18, 2:36 pm, gaurav kashyap <[EMAIL PROTECTED]> wrote:
> Hi all,
> I have a text file in a directory on unix system.
> Using a python program i want to change that file's permissions.
> How could this be done.
>
> Thanks
help(os.chmod)
Help on built-in function chmod in module nt:
chmod(..
On Feb 23, 11:57 am, Stef Mientki wrote:
> thanks Ron,
>
> but I was looking for a more general solution,
> in which I don't change the program itself,
> and where the error messages (in general) become more informative than
> it is by default.
>
> cheers,
> Stef
>
> Barak, Ron wrote:
> > Hi Stef,
On Mar 30, 1:47 pm, CinnamonDonkey
wrote:
> Hi All,
>
> I had the following bit of code which was working fine until we went
> into Daylight saving this weekend, now the result is an hour out.
>
> timeString = "20090330 15:45:23"
>
> timeFormat = '%Y-%m-%d %H:%M:%S'
>
> modificationTim
I am a newby in Python and I'm first looking for equivalent to things
I already manage: IDL.
For example, I want to plot a sub-set of points, selected from a
bigger set by applying some filter. In my example, I want to select
only the values > 0.
I succeed to write 5 different ways to do this, whic
On May 11, 3:12 am, globalrev <[EMAIL PROTECTED]> wrote:
> http://reddit.com/r/programming/info/18td4/comments
>
> claims people take a lot of time to write a simple program like this:
>
> "Write a program that prints the numbers from 1 to 100. But for
> multiples of three print "Fizz" instead of t
On May 15, 2:27 pm, globalrev <[EMAIL PROTECTED]> wrote:
> i have a big collection of .txt files that i want to open and parse to
> extract information.
>
> is there a library for this or maybe even built in?
os.open to open the files and iterate through it and built in string
functions to parse i
On May 15, 5:13 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've had this niggling issue from time to time. I want to create a
> shortcut on the user's desktop to a website that specifically loads
> Firefox even if Firefox is not the default browser.
>
> I usually use COM as it allows ve
On May 20, 8:34 pm, [EMAIL PROTECTED] wrote:
> i have a big file with sentences, the first file of each sentence
> contains a colon(:) somewher eon that line
> i want to jump past that sentence.
>
> if all(x != ':' for x in line):
>
> this way i can check but i dont want to check for every line in
On May 28, 11:08 am, [EMAIL PROTECTED] wrote:
> Hi,
>
> I have problems getting my Python code to work with UTF-8 encoding
> when reading from stdin / writing to stdout.
>
> Say I have a file, utf8_input, that contains a single character, é,
> coded as UTF-8:
>
> $ hexdump -C utf8_input
>
On May 28, 10:59 am, [EMAIL PROTECTED] wrote:
> On May 28, 3:47 am, Matt Nordhoff <[EMAIL PROTECTED]> wrote:
>
>
>
> > [EMAIL PROTECTED] wrote:
> > > I wanted to ask for ways to test whether a path exists. I usually use
> > > os.path.exists(), which does a stat call on the path and returns True
> >
On May 28, 12:25 pm, "James" <[EMAIL PROTECTED]> wrote:
> Hey everyone,
>
> I just started using python and cant figure this out, I'm trying to
> make a program where someone types in a word and the program gives it
> back backwards. For example if the person puts in "cat" I want the
> program to
On May 29, 10:36 am, loial <[EMAIL PROTECTED]> wrote:
> I have a requirement to compare 2 text files and write to a 3rd file
> only those lines that appear in the 2nd file but not in the 1st file.
>
> Rather than re-invent the wheel I am wondering if anyone has written
> anything already?
How larg
On Jun 2, 9:34 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> i am building a little script and i want to output a series of columns
> more or less like this:
>
> 1 5 6
> 2 2 8
> 2 9 5
>
> The matter is that i don't know in advance how many columns there will
> be. By the way, e
On Jun 2, 12:35 pm, TheSaint <[EMAIL PROTECTED]> wrote:
> Hi,
> I using eval for quite strange reason, as long as I don't know a different
> way to implement.
>
> An example:
>
> actions= ('print', 'sum', 'divide', 'myfunction')
> parameters=(5, 'nothing',5.63, object)
>
> for routines in actions:
On Jun 2, 9:43 pm, Doug Morse <[EMAIL PROTECTED]> wrote:
> On Mon, 2 Jun 2008 12:42:12 -0700 (PDT), Mensanator <[EMAIL PROTECTED]> wrote:
> > On Jun 2, 3:38 am, Chris <[EMAIL PROTECTED]> wrote:
> > > On Jun 2, 9:34 am, "[EMAIL PROTECTED]"
>
> &g
On Jun 2, 11:34 pm, Chris <[EMAIL PROTECTED]> wrote:
> On Jun 2, 9:43 pm, Doug Morse <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Mon, 2 Jun 2008 12:42:12 -0700 (PDT), Mensanator <[EMAIL PROTECTED]>
> > wrote:
> > > On Jun 2, 3:38 am, Chris &
On Jun 3, 8:40 pm, tmallen <[EMAIL PROTECTED]> wrote:
> What's the proper way to instantiate a new variable? x = ""?
You don't need to pre-declare your variables. Just assign them as you
need them and they will take the correct type.
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 3, 10:11 pm, Matthew Wilson <[EMAIL PROTECTED]> wrote:
> I used defaultdict.fromkeys to make a new defaultdict instance, but I
> was surprised by behavior:
>
> >>> b = defaultdict.fromkeys(['x', 'y'], list)
>
> >>> b
> defaultdict(None, {'y': , 'x': })
>
> >>> b['x']
>
>
On Jun 3, 9:34 pm, "Dan Upton" <[EMAIL PROTECTED]> wrote:
> On Tue, Jun 3, 2008 at 3:16 PM, tmallen <[EMAIL PROTECTED]> wrote:
> > On Jun 3, 3:03 pm, Chris <[EMAIL PROTECTED]> wrote:
> >> On Jun 3, 8:40 pm, tmallen <[EMAIL PROTECTED]> wrote:
On Jun 4, 9:56 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Tue, 3 Jun 2008 23:48:38 -0700 (PDT), [EMAIL PROTECTED] declaimed the
> following in comp.lang.python:
>
> > Is there way to configure the stdout buffer size so that it flushes
> > earlier..
> > Is there a way to make above mentio
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 chara
On Jun 6, 10:22 am, luca72 <[EMAIL PROTECTED]> wrote:
> Hello i can't import cherrypy2 but i don't know why this is the sys
> path:
>
> '', '/home/pirataja/opo.net/python/lib/python2.5/site-packages/
> setuptools-0.6c7-py2.5.egg', '/home/pirataja/opo.net/python/lib/
> python2.5/site-packages/TurboG
On Jun 6, 10:59 am, luca72 <[EMAIL PROTECTED]> wrote:
> On 6 Giu, 10:31, Chris <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jun 6, 10:22 am, luca72 <[EMAIL PROTECTED]> wrote:
>
> > > Hello i can't import cherrypy2 but i don't know why this
On Jun 9, 5:02 pm, Johny <[EMAIL PROTECTED]> wrote:
> How can I find the first space using regex?
>
> For example I have text
> Text=' This is a sample '
>
> The last space I can remove by
> Text=re.sub(r"\s(?!\w)",'',Text)
>
> but I do not know how to remove the first space.
> Can anyone help?
>
>
On Jun 11, 6:20 am, cirfu <[EMAIL PROTECTED]> wrote:
> pat = re.compile("(\w* *)*")
> this matches all sentences.
> if fed the string "are you crazy? i am" it will return "are you
> crazy".
>
> i want to find a in a big string a sentence containing Zlatan
> Ibrahimovic and some other text.
> ie ret
On Jun 11, 10:32 am, MRAB <[EMAIL PROTECTED]> wrote:
> On Jun 10, 10:57 pm, "Steven Clark" <[EMAIL PROTECTED]> wrote:
>
> > > for 1 in oids, vals head_oids:
> > > SyntaxError: can't assign to literal
> > > --
>
> > 1 is a literal, you can't assign it to something. Are you trying to
> > use it as a
On Jun 12, 8:03 am, TheSaint <[EMAIL PROTECTED]> wrote:
> On 01:37, giovedì 12 giugno 2008 Ethan Furman wrote:
>
> > Do you mean indenting, or wrapping?
>
> I mean fill the line by increasing spaces between words in order to get a
> paragraph aligned both side, left and right on the page.
> So if t
On Jun 12, 1:48 pm, Nader <[EMAIL PROTECTED]> wrote:
> On Jun 12, 1:35 pm, [EMAIL PROTECTED] wrote:
>
>
>
> > Nader:
>
> > > d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}
> > > I will something as :
> > > d.keys(where their values are the same)
>
> > That's magic.
>
> > > With
On Jun 12, 2:15 pm, Nader <[EMAIL PROTECTED]> wrote:
> On Jun 12, 2:05 pm, Chris <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jun 12, 1:48 pm, Nader <[EMAIL PROTECTED]> wrote:
>
> > > On Jun 12, 1:35 pm, [EMAIL PROTECTED] wrote:
>
> > > > N
On Jun 12, 3:48 pm, Mark <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a scenario where I have a list like this:
>
> User Score
> 1 0
> 1 1
> 1 5
> 2 3
> 2 1
> 3 2
> 4 3
> 4
On Jun 12, 4:27 pm, Phillip B Oldham <[EMAIL PROTECTED]> wrote:
> I'm keen on learning python, with a heavy lean on doing things the
> "pythonic" way, so threw the following script together in a few hours
> as a first-attempt in programming python.
>
> I'd like the community's thoughts/comments on
ill that cause any weird errors?
>
> Also, Chris, can you explain this:
> a, b = line.split(': ')[:2]
>
> I understand the first section, but I've not seen [:2] before.
That's slicing at work. What it is doing is only taking the first two
elements
On Jun 13, 4:15 pm, ericdaniel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm new to Python and I need to do the following:
>
> from this: s = "978654321"
> to this : ["978", "654", "321"]
>
> Any help is appreciated
>
> Thanks,
>
> Eric
What you could do is iterate over the string appending the
Error: [Errno socket error] (54, 'Connection reset by peer')
>
>
>
> My script code is as follows:
> -
> import os
> import urllib
>
> volume_number = 149 # The volumes number 150 to 544
>
> while volume_number < 544
Is anyone aware of any prior work done with searching or matching a
pattern over nested Python lists? I have this problem where I have a
list like:
[1, 2, [1, 2, [1, 7], 9, 9], 10]
and I'd like to search for the pattern [1, 2, ANY] so that is returns:
[1, 2, [1, 2, [6, 7], 9, 9], 10]
[1, 2, [6,
On Jun 17, 5:50 am, [EMAIL PROTECTED] wrote:
> I'm writing to see calcuration process.
> And so, I can't catch StopIteration...
>
> What is mistake?
>
> def collatz(n):
> r=[]
> while n>1:
> r.append(n)
> n = 3*n+1 if n%2 else n/2
> yield r
>
> for i, x in enumerate(collatz(13)):
>
On Jun 17, 8:43 am, Chris <[EMAIL PROTECTED]> wrote:
> On Jun 17, 5:50 am, [EMAIL PROTECTED] wrote:
>
>
>
> > I'm writing to see calcuration process.
> > And so, I can't catch StopIteration...
>
> > What is mistake?
>
> > def collatz(n):
On Jun 17, 8:15 am, pirata <[EMAIL PROTECTED]> wrote:
> I was trying to print a dot on console every second to indicates
> running process, so I wrote, for example:
>
> for i in xrange(10):
> print ".",
> time.sleep(1)
>
> Idealy, a dot will be printed out each second. But there is nothing
201 - 300 of 19065 matches
Mail list logo