Hello,
Strip ('"'') does not work.
Still this message : SyntaxError: EOL while scanning string literal
So I think I go for the suggestion of Bob en develop a programm which deletes
all the ' and " by scanning it character by character.
Roelof
>
>>
On 14-09-10 09:28, Roelof Wobben wrote:
Hello,
Strip ('"'') does not work.
Still this message : SyntaxError: EOL while scanning string literal
Review it again, see how many quotes you are using.
For example, this won't work either:
>>> s = 'foo'bar'
You need to escape the quotes with a
> Date: Tue, 14 Sep 2010 09:32:38 +0200
> From: timomli...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] FW: wierd replace problem
>
> On 14-09-10 09:28, Roelof Wobben wrote:
>>
>>
>> Hello,
>>
>> Strip ('"'') does not work.
>> Still this messag
Pete O'Connell wrote:
> theList = ["21 trewuuioi","3zxc","134445"]
> print sorted(theList)
>
> Hi, the result of the sorted list above doesn't print in the order I
> want. Is there a straight forward way of getting python to print
> ['3zxc','21 trewuuioi','134445']
> rather than ['134445', '21 tr
On 14 September 2010 08:38, Roelof Wobben wrote:
>
> I understand what you mean but we're talking about a text-file which will
> be read in a string.
> So I can't escape the quotes. As far as I know I can't control how Python
> is reading a text-file with quotes.
>
>
Putting a value into a strin
On Tue, Sep 14, 2010 at 5:28 PM, Roelof Wobben wrote:
> Strip ('"'') does not work.
> Still this message : SyntaxError: EOL while scanning string literal
>
> So I think I go for the suggestion of Bob en develop a programm which deletes
> all the ' and " by scanning it character by character.
I s
On 14 September 2010 11:09, James Mills wrote:
> $ python
> Python 2.6.5 (r265:79063, Jun 13 2010, 14:03:16)
> [GCC 4.4.4 (CRUX)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> s = "foo\"bar'"
> >>> s
> 'foo"bar\''
>
I'd like to point something out here.
On 13/09/2010 20.21, Roelof Wobben wrote:
...
The problem as stated in the book is :
3.Write a program called alice_words.py that creates a text file named
alice_words.txt containing an alphabetical listing of all the words found in
alice_in_wonderland.txt together with the number of times e
Oke,
Can this also be the same problem.
In the text is this :
'tis is represent as "'this
And this
part is represent as part.
Roelof
> Date: Tue, 14 Sep 2010 11:41:28 +0100
> From: wpr...@gmail.com
> To: tutor@python.org
> Subject: Re: [Tutor] FW:
On Tue, 14 Sep 2010 02:08:43 pm Vince Spicer wrote:
> Hey Tyler you can simplify this with a onliner.
>
> rg1, rg2, rg3 = rgenre + ["NA"]*(3-len(rgenre[:3]))
There's no real need to calculate the exact length that you want:
rg1, rg2, rg3 = (rgenre + ["NA"]*3)[:3]
For small numbers of items -- a
On Tue, 14 Sep 2010 09:42:15 pm Michael Powe wrote:
> Just a plea to remember to take the time to `C-k' or `dd' or whatever
> is required to get that extraneous material out of the mail. A
> little formatting goes a long way.
Seconded, thirded, fourthed and fifthed.
For those using a GUI email
On Tue, 14 Sep 2010 05:38:18 pm Roelof Wobben wrote:
> >> Strip ('"'') does not work.
> >> Still this message : SyntaxError: EOL while scanning string
> >> literal
[...]
> I understand what you mean but we're talking about a text-file which
> will be read in a string. So I can't escape the quotes.
On Tue, 14 Sep 2010 03:28:46 am Alan Gauld wrote:
> "Roelof Wobben" wrote
>
> > Now I want to get rid of the \\ so I do this : test2 = test.replace
> > ('\\', '')
> > And I get at the python prompt this answer : 'het is een wonder
> > TIS' So that's right.
>
> OK,. Thats replacing a double slash i
Hello,
I read this list in a linux console using mutt. I dunno, maybe I'm the
only idiot left still using a console mail client. I write my emails
and email replies in emacs, too, which may make me even weirder.
Few elements make a mail harder to read than 130 lines of nested
quoting, into which
On Tue, 14 Sep 2010 11:11:33 am Adam Bark wrote:
> On 14/09/10 01:11, Pete O'Connell wrote:
> > theList = ["21 trewuuioi","3zxc","134445"]
> > print sorted(theList)
> >
> > Hi, the result of the sorted list above doesn't print in the order
> > I want. Is there a straight forward way of getting pyth
> > ['3zxc','21 trewuuioi','134445']
> > > rather than ['134445', '21 trewuuioi', '3zxc']?
> > >
> > > Any help would be greatly appreciated
> > > Pete
>
> There seem to be two different ways of understand the OP sort order.
>
The way I took it, 3zxc comes first because the number is 3 which is sm
On Tue, 14 Sep 2010 01:58:07 pm aenea...@priest.com wrote:
> if len(rgenre)>0:
> if len(rgenre)>2:
> rg1=rgenre[0]
> rg2=rgenre[1]
> rg3=rgenre[2]
> elif len(rgenre)==2:
> rg1=rgenre[0]
> rg2=rgenre[1]
>
My humble guess: (sure, the full traceback would help A LOT!)
On 09/09/2010 23.52, Todd Ballard wrote:
y=[daily_solar_radiation["MJ"][0]]
for i in xrange(0,275):
y=[daily_solar_radiation["MJ"]][i]+y[i-1] # <--THIS y[i-1] is out of
bounds when i=0 !!!
Hope that helps
Francesco
Nessun vir
> From: st...@pearwood.info
> To: tutor@python.org
> Date: Tue, 14 Sep 2010 21:30:01 +1000
> Subject: Re: [Tutor] FW: wierd replace problem
>
> On Tue, 14 Sep 2010 05:38:18 pm Roelof Wobben wrote:
>
Strip ('"'') does not work.
Still this message
On Tue, Sep 14, 2010 at 10:29 AM, Roelof Wobben wrote:
I offer my solution. I didn't bother to make every word lower case, and I
think that would improve the result
Please offer critique, improvements
Some explaination:
line 5 -- I read the complete text into full_text, while first replacing
> From: rwob...@hotmail.com
> To: joel.goldst...@gmail.com
> Subject: RE: [Tutor] FW: wierd replace problem
> Date: Tue, 14 Sep 2010 15:43:42 +
>
>
>
>
>
>> Date: Tue, 14 Sep 2010 11:28:10 -0400
>> From: joel.goldst...
On 14/09/2010 16.29, Roelof Wobben wrote:
...
Oke,
I see the problem.
When I have this sentence : `'Tis so,' said the Duchess: `and the moral of that
is--"Oh,
'tis love, 'tis love, that makes the world go round!"'
And I do string.strip() the output will be :
`'This and that one does not fit
Date: Tue, 14 Sep 2010 17:45:35 +0200
From: f...@libero.it
To: tutor@python.org
Subject: Re: [Tutor] FW: wierd replace problem
On 14/09/2010 16.29, Roelof Wobben wrote:
>...
> Oke,
>
> I see the problem.
>
> When I have this sentence : `'Tis so,' said t
Hi all,
I have a regex that matches dates in various formats. I've tested the regex
in a reliable testbed, and it seems to match what I want (dates in formats
like "1 Jan 2010" and "January 1, 2010" and also "January 2008"). It's just
that using re.findall with it is giving me weird output. I'm
On 14-09-10 17:44, Roelof Wobben wrote:
9 stripped_words = words.strip(".,!?'`\"- ();:")
Hello Joel,
Your solution works.
Im getting grazy. I tried it two days with strip and get a eof error message
and now no messages.
Look at the backslash! It doesn't strip the backslash
On Tue, Sep 14, 2010 at 12:35 PM, Roelof Wobben wrote:
>
>
>
>
> But how can I use the triple quotes when reading a textf-file ?
> Roelof
>
The triple quotes let you put quotes inside them... for instance if you want
to check for single and double quotes, and ) you can do this:
"""'")"""
its h
> I have a regex that matches dates in various formats. I've tested the regex
> in a reliable testbed, and it seems to match what I want (dates in formats
> like "1 Jan 2010" and "January 1, 2010" and also "January 2008"). It's just
> that using re.findall with it is giving me weird output. I
Hi Evert,
Thank you. I should have figured "groups" were the paren groups. I see it
clearly now. And your solution will work for the larger thing I'm trying to
do --- thanks.
And yes: I know this matches some non-date-like dates, but the data is such
that it should work out ok.
Thanks again,
On Tue, Sep 14, 2010, Michael Powe wrote:
>Hello,
>
>I read this list in a linux console using mutt. I dunno, maybe I'm the
>only idiot left still using a console mail client. I write my emails
>and email replies in emacs, too, which may make me even weirder.
Mutt in xterms here with vi (I've nev
- Original message -
> Look at the backslash! It doesn't strip the backslash in the string, but
> it escapes the double quote following it.
>
> I don't know how people can explain it any better.
Maybe the link below makes it clear what backslash really does.
http://pythonconquerstheuni
> From: rwob...@hotmail.com
> To: sander.swe...@gmail.com
> Subject: RE: [Tutor] FW: wierd replace problem
> Date: Tue, 14 Sep 2010 17:40:28 +
>
>
>
>
>
>> From: sander.swe...@gmail.com
>> To: tutor@python.org
On 14/09/2010 18.35, Roelof Wobben wrote:
...
It was not confusing when I read your explanation.
Still im grazy wht with you and Joel the strip works and with me I get errors.
But how can I use the triple quotes when reading a textf-file ?
Very easy: YOU DON'T NEED TO USE ANY QUOTES.
All the qu
On Tue, Sep 14, 2010 at 01:09:21PM -0400, Michael Scharf wrote:
> Thank you. I should have figured "groups" were the paren groups. I see it
> clearly now. And your solution will work for the larger thing I'm trying to
> do --- thanks.
> And yes: I know this matches some non-date-like dates, b
Roelof,
On 14 September 2010 17:35, Roelof Wobben wrote:
> But how can I use the triple quotes when reading a textf-file ?
>
To repeat what I said before, obviously not clearly enough: All the quoting
stuff, escaping stuff, all of that ONLY APPLIES TO STRINGS/DATA INSIDE OF
YOUR PYTHON CODE.
> Date: Tue, 14 Sep 2010 21:05:06 +0100
> Subject: Re: [Tutor] FW: wierd replace problem
> From: wpr...@gmail.com
> To: rwob...@hotmail.com
> CC: tutor@python.org
>
> Roelof,
>
> On 14 September 2010 17:35, Roelof Wobben
>> wrote:
> But how can I use the triple q
I'm using python 3.1 with py-postgresql (located at
http://python.projects.postgresql.org/
I need to work through how best to paginate larger sql result sets.
my SELECT statement returns a list, I can get its len() to find out
that X records were returned
What I want to do is print the first N r
On 14 September 2010 21:10, Roelof Wobben wrote:
> I understand it but I try to understand why in a file there is this 'word
> python makes a "'word.
>
Python doesn't change what it reads from the file. However, depending on
how you ask Python to tell you what it's read (or what the contents of
Correction on my last paragraph on my last mail:
"See also when Python is asked to "print" the string, you can see the escape
characters really there." -> "See also when Python is asked to "print" the
string, you can see the escape characters aren't part of the actual contents
of the string."
_
On Wed, 15 Sep 2010 07:20:33 am Walter Prins wrote:
> Correction on my last paragraph on my last mail:
> "See also when Python is asked to "print" the string, you can see the
> escape characters really there." -> "See also when Python is asked to
> "print" the string, you can see the escape charact
Hi! I have a problem. I just started python. when I use (open) function, is the
file supposed to open? Because it doesn't.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
htt
On Wed, Sep 15, 2010 at 1:38 AM, Sukhpal Saini wrote:
> Hi! I have a problem. I just started python. when I use (open) function,
> is the file supposed to open? Because it doesn't.
>
f = open('filename', 'r') opens the file in read-only format. There are
others like binary, write, append etc. C
"Sukhpal Saini" wrote
Hi! I have a problem. I just started python. when I
use (open) function, is the file supposed to open?
Because it doesn't.
How do you know? Are you also new to programming?
Or do you know another programming language?
Assuming that you are new to programming
Are you
"Steven D'Aprano" wrote
OK,. Thats replacing a double slash in the data
Er, surely not... I think you've confused backslashes and forward
slashes. Or something. '\\' is a single backslash, not a double,
because the first backslash is the escape character.
A double backslash can be writt
"ANKUR AGGARWAL" wrote
Suppose i am taking input or various variables like
a=raw_input("...") //hello
b=raw_input("")//hi
but i want to run a common function when input is hello
so instead of
if a=="hello":
fun()
then again for b and then again for c then d and so
"Rance Hall" wrote
I'm using python 3.1 with py-postgresql (located at
http://python.projects.postgresql.org/
I need to work through how best to paginate larger sql result sets.
Its usually best to do that at the SQL level by controlling the
cursor.
I don't know PostGres but most SQL dial
Hi
When I enter myvar= raw_input ("Please excuse a number of movies: ")
and I try and convert it to an integer it gives me an error message.
I put in:
movietotal= int("myvar")* 3 and I get an error message
Ciera
___
Tutor maillist - Tutor@python.org
On Tue, Sep 14, 2010 at 8:00 PM, Ciera Jones wrote:
> Hi
> When I enter myvar= raw_input ("Please excuse a number of movies: ")
> and I try and convert it to an integer it gives me an error message.
> I put in:
> movietotal= int("myvar")* 3 and I get an error message
> Ciera
>
post your code..
"Ciera Jones" wrote
When I enter myvar= raw_input ("Please excuse a number of movies: ")
and I try and convert it to an integer it gives me an error message.
I put in:
movietotal= int("myvar")* 3 and I get an error message
Don't put quotes around the variable name.
Python is trying to conve
Greetings tutors.
First off, here is what I'm doing. I'm taking pi (3.141592 etc. etc.
etc.), taking two values at a time, and then mapping the two values to
pitch and length. I'm then using winsound.Beep to beep for x ms, at y
frequency. What I want to do, is write that to file. Judging from
Hi all,
Out of curiosity: I know I can call dll functions from python using
the win32 lib, but is there any way to simply "examine" a loaded dll
to see all of the functions and attributes it exposes for use? I would
do no good with a hex editor since I have no idea what all the numbers
mean, so I a
> the win32 lib, but is there any way to simply "examine" a loaded dll
> to see all of the functions and attributes it exposes for use? I would
http://www.dependencywalker.com/
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscriptio
On Tue, Sep 14, 2010 at 7:15 PM, Alan Gauld wrote:
>
> "Rance Hall" wrote
>
>> I'm using python 3.1 with py-postgresql (located at
>> http://python.projects.postgresql.org/
>>
>> I need to work through how best to paginate larger sql result sets.
>
> Its usually best to do that at the SQL level b
dear group:
I have a dictionary object that looks like this:
xdic
{11135457: [1], 11135492: [1], 11135913: [1], 11135436: [1, 2], 11135699: [1,
2], 11135702: [1, 3], 11135901: [1]}
I want to print only those items that have [1,2] and [1,3] in any order, such
as [1,2] or [2,1], [3,1] or [1
On 9/14/10, R. Alan Monroe wrote:
>> the win32 lib, but is there any way to simply "examine" a loaded dll
>> to see all of the functions and attributes it exposes for use? I would
>
> http://www.dependencywalker.com/
A great program, thanks! Best of all, for me anyway, it works well (so
far) with
xdic
{11135457: [1], 11135492: [1], 11135913: [1], 11135436: [1, 2],
11135699: [1, 2], 11135702: [1, 3], 11135901: [1]}
I want to print only those items that have [1,2] and [1,3] in any order,
such as [1,2] or [2,1], [3,1] or [1,3]
>>> for item in xdic.keys():
... if [1,2] in xdic[item]:
...
55 matches
Mail list logo