On Friday, April 3, 2015 at 8:10:54 PM UTC+5:30, Chris Angelico wrote:
> On Fri, Apr 3, 2015 at 11:52 PM, Rustom Mody wrote:
> > Speaking about silliness of definitions, I was knocked out in class by this
> > today:
> >
> r"\""
> > '\\"'
> >
> > Seeing the docs
> > https://docs.python.org/3.
On Fri, Apr 3, 2015 at 11:52 PM, Rustom Mody wrote:
> Speaking about silliness of definitions, I was knocked out in class by this
> today:
>
r"\""
> '\\"'
>
> Seeing the docs
> https://docs.python.org/3.4/reference/lexical_analysis.html#string-and-bytes-literals
> it talks of this explicitly
On 1/18/2010 8:01 AM, Colin W. wrote:
On 17-Jan-10 18:27 PM, Steven D'Aprano wrote:
On Sun, 17 Jan 2010 11:13:48 -0500, Roy Smith wrote:
In article,
"Colin W." wrote:
On 17-Jan-10 02:16 AM, Terry Reedy wrote:
On 1/17/2010 1:55 AM, Brendan Miller wrote:
Is there any difference whatsoever be
On 17-Jan-10 18:27 PM, Steven D'Aprano wrote:
On Sun, 17 Jan 2010 11:13:48 -0500, Roy Smith wrote:
In article,
"Colin W." wrote:
On 17-Jan-10 02:16 AM, Terry Reedy wrote:
On 1/17/2010 1:55 AM, Brendan Miller wrote:
Is there any difference whatsoever between a raw string beginning
with th
On Sun, 17 Jan 2010 11:13:48 -0500, Roy Smith wrote:
> In article ,
> "Colin W." wrote:
>
>> On 17-Jan-10 02:16 AM, Terry Reedy wrote:
>> > On 1/17/2010 1:55 AM, Brendan Miller wrote:
>> >> Is there any difference whatsoever between a raw string beginning
>> >> with the captical R or one with t
In article ,
Colin W. wrote:
>On 17-Jan-10 02:16 AM, Terry Reedy wrote:
>> On 1/17/2010 1:55 AM, Brendan Miller wrote:
>>>
>>> Is there any difference whatsoever between a raw string beginning with
>>> the captical R or one with the lower case r e.g. r"string" vs
>>> R"string"?
>>
>> No. Nor is th
In article ,
"Colin W." wrote:
> On 17-Jan-10 02:16 AM, Terry Reedy wrote:
> > On 1/17/2010 1:55 AM, Brendan Miller wrote:
> >> Is there any difference whatsoever between a raw string beginning with
> >> the captical R or one with the lower case r e.g. r"string" vs
> >> R"string"?
> >
> > No. No
On 17-Jan-10 02:16 AM, Terry Reedy wrote:
On 1/17/2010 1:55 AM, Brendan Miller wrote:
Is there any difference whatsoever between a raw string beginning with
the captical R or one with the lower case r e.g. r"string" vs
R"string"?
No. Nor is there and difference between the strings created with
On 1/17/2010 1:55 AM, Brendan Miller wrote:
Is there any difference whatsoever between a raw string beginning with
the captical R or one with the lower case r e.g. r"string" vs
R"string"?
No. Nor is there and difference between the strings created with raw
literals and cooked literals.
--
h
Brendan Miller writes:
> Is there any difference whatsoever between a raw string beginning with
> the captical R or one with the lower case r e.g. r"string" vs
> R"string"?
For answering questions like this, the Python language reference is your
friend:
String literals may optionally be pre
On Tue, 30 Sep 2008 10:50:01 -0700, Kyle Hayes wrote:
>> Please describe the actual problem you're trying to solve. In what way
>> do slashes need to be "fixed," and why?
>
> Well, I have decided to build a tool to help us sync files in UNC paths.
> I am just building the modules and classes righ
Kyle Hayes wrote:
>> Please describe the actual problem you're trying to solve. In what way
>> do slashes need to be "fixed," and why?
>
> Well, I have decided to build a tool to help us sync files in UNC
> paths. I am just building the modules and classes right now so I
> haven't developed the fr
On Sep 30, 1:17 pm, Kyle Hayes <[EMAIL PROTECTED]> wrote:
> Is there a way to use the 'r' in front of a variable instead of
> directly in front of a string? Or do I need to use a function to get
> all of the slashes automatically fixed?
Is this what you're talking about?
str = "foo/bar"
re =
> Please describe the actual problem you're trying to solve. In what way
> do slashes need to be "fixed," and why?
Well, I have decided to build a tool to help us sync files in UNC
paths. I am just building the modules and classes right now so I
haven't developed the frontend yet. I am assuming wh
Kyle Hayes wrote:
> Is there a way to use the 'r' in front of a variable instead of
> directly in front of a string? Or do I need to use a function to get
> all of the slashes automatically fixed?
Please describe the actual problem you're trying to solve. In what way
do slashes need to be "fixed,"
En Sun, 18 May 2008 02:49:03 -0300, Dick Moores <[EMAIL PROTECTED]> escribió:
> However, (please refer back to my original post)
> I want to keep the fstr, ultimately to be the
> string entered by the user who knows a bit about
> regex, but not how to use r' ' . Or
> alternatively, not assume any
At 10:17 PM 5/17/2008, Gabriel Genellina wrote:
En Sat, 17 May 2008 23:37:16 -0300, Dick Moores <[EMAIL PROTECTED]> escribió:
> I have a text file of phone numbers, which I'd like to search with a regex.
>
> fstr = "\sjoe\s"
> regex = "^.*" + fstr + ".*$"
>
> fstr = "\sjoe\s"
> regex = "r'^.*" +
En Sat, 17 May 2008 23:37:16 -0300, Dick Moores <[EMAIL PROTECTED]> escribió:
> I have a text file of phone numbers, which I'd like to search with a regex.
>
> fstr = "\sjoe\s"
> regex = "^.*" + fstr + ".*$"
>
> fstr = "\sjoe\s"
> regex = "r'^.*" + fstr + ".*$'"
The r"..." is a signal to the pars
>> On a semi-related note, I have a database on Linux that imports from a
>> Macintosh CSV file. The 'csv' module says to always open files in
>> binary mode, but this didn't work in my case: I had to open it as 'rU'
>> (text with universal newlines) or 'csv' misparsed it. I'd like the
>> program
On 27/06/2006 6:39 AM, Mike Orr wrote:
> Tim Peters wrote:
>> [EP <[EMAIL PROTECTED]>]
>>> This inquiry may either turn out to be about the suitability of the
>>> SHA-1 (160 bit digest) for file identification, the sha function in
>>> Python ... or about some error in my script
>> It's your script.
"RK" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> ok, who's been playing with mailman?
I am sure the problem is a mis-configured auto-responder robot. Nothing
like telling the world that you are not around to watch your home or
office, Reminds me of when newspapers used to
RK wrote:
> ok, who's been playing with mailman?
I thought you were going to say something like "I hope he turned off the
lights before leaving the office"... :-)
--
Jorge Godoy <[EMAIL PROTECTED]>
"Quidquid latine dictum sit, altum sonatur."
- Qualquer coisa dita em latim soa profundo.
ok, who's been playing with mailman?
--
http://mail.python.org/mailman/listinfo/python-list
Blackbird wrote:
> By "cargo cult programming", do you mean actually *running* the code?
no, I mean basing your mental model of something on distant observations
of superficial (or accidental) artifacts (like the perceived similarity between
the output from repr() and the raw string literal synta
In <[EMAIL PROTECTED]>, Blackbird wrote:
> By "cargo cult programming", do you mean actually *running* the code?
http://www.catb.org/~esr/jargon/html/C/cargo-cult-programming.html
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
Blackbird wrote:
> Blackbird <[EMAIL PROTECTED]> skrev:
>
>>>
>> Is the interpreter in fact using repr(), or parts of it, to generate
>> output when you type an expression at the command prompt? The
>> results sure look similar.
>
> Let me clarify this: The interpreter uses eval. No doubt about
Blackbird <[EMAIL PROTECTED]> skrev:
>>
> Is the interpreter in fact using repr(), or parts of it, to generate
> output when you type an expression at the command prompt? The
> results sure look similar.
Let me clarify this: The interpreter uses eval. No doubt about that. But
>>> eval('f')
>
Peter Hansen wrote:
> [...]>
> On the other hand, if 'something' is actually some arbitrary object,
> then it's definitely not always true, especially for anything not
> built in to Python.
>
> -Peter
Yes, I had strings in mind. And I guess it will work with the other
primitive types, but anythin
Fredrik Lundh wrote:
> "Blackbird" <[EMAIL PROTECTED]> wrote:
>
[...]
>>>
>> a = 'I don\'t think so'
>> print '%r' % a
>>> "I don't think so"
>> a = r'I don\'t think so'
>> print "'%s'" % a
>>> 'I don\'t think so'
>>
>> Excellent counterexample. Can something like this happen
Blackbird wrote:
> a = 'something'
> b = ('%r'%a)
> eval(b) == a
>
> that in general should return True. I hope. But I'm sure there are
> counterexamples to that, too.
Provided 'something' is a string, that should be true, as should the
simpler statement a == eval(repr(a)) (since '%r' is jus
Peter Hansen wrote:
> Blackbird wrote:
>> I'm trying to get a complete grip on %r. Is it true that the two
>> programs
>>
>> a = '*anything the parser accepts*'
>> print '%r' % a
>>
>> vs.
>>
>> a = r'*anything the parser accepts*'
>> print "'%s'" % a
>>
>> always produce the same output, where *a
"Blackbird" <[EMAIL PROTECTED]> wrote:
> >> [...]
> >
> a = 'I don\'t think so'
> print '%r' % a
> > "I don't think so"
> a = r'I don\'t think so'
> print "'%s'" % a
> > 'I don\'t think so'
>
> Excellent counterexample. Can something like this happen for other things
> than qu
Duncan Booth wrote:
> Blackbird wrote:
>
>> [...]
>
a = 'I don\'t think so'
print '%r' % a
> "I don't think so"
a = r'I don\'t think so'
print "'%s'" % a
> 'I don\'t think so'
Excellent counterexample. Can something like this happen for other things
than quotes?
--
http://m
Blackbird wrote:
> I'm trying to get a complete grip on %r. Is it true that the two programs
>
> a = '*anything the parser accepts*'
> print '%r' % a
>
> vs.
>
> a = r'*anything the parser accepts*'
> print "'%s'" % a
>
> always produce the same output, where *anything the parser accepts* can
"Blackbird" wrote:
> I'm trying to get a complete grip on %r. Is it true that the two programs
>
> a = '*anything the parser accepts*'
> print '%r' % a
>
> vs.
>
> a = r'*anything the parser accepts*'
> print "'%s'" % a
>
> always produce the same output, where *anything the parser accepts* can be
Blackbird wrote:
> I'm trying to get a complete grip on %r. Is it true that the two
> programs
>
> a = '*anything the parser accepts*'
> print '%r' % a
>
> vs.
>
> a = r'*anything the parser accepts*'
> print "'%s'" % a
>
> always produce the same output, where *anything the parser accepts*
John Machin wrote:
> Many people don't appear to want to know why; they only want a solution
> to what they perceive to be their current problem.
and many people can identify a short HOWTO when they see it, and look
things up in the documentation when they want the full story. reposting
the docu
Steven D'Aprano wrote:
> So going back to the original question... if I open in "r" mode a text
> file which was created under Windows, I will get \r characters in the
> text and have to deal with them regardless of what platform I am running
> Python under. Correct?
Almost, but the way you phrase
Steven D'Aprano wrote:
> On Mon, 13 Jun 2005 11:53:25 +0200, Fredrik Lundh wrote:
>
>
>><[EMAIL PROTECTED]> wrote:
>>
>>
>>>It means in windows we should use 'wb' to write and 'rb' to read ?
>>>Am I right?
>>
>>no.
>>
>>you should use "wb" to write *binary* files, and "rb" to read *binary*
>>file
On Mon, 13 Jun 2005 10:52:52 -0400, Peter Hansen wrote:
> Steven D'Aprano wrote:
>> When you read a Windows text file using "r" mode, what happens to the \r
>> immediately before the newline? Do you have to handle it yourself? Or will
>> Python cleverly suppress it so you don't have to worry about
On Monday 13 June 2005 09:34 am, Steven D'Aprano wrote:
> On Mon, 13 Jun 2005 11:53:25 +0200, Fredrik Lundh wrote:
> > <[EMAIL PROTECTED]> wrote:
> >> It means in windows we should use 'wb' to write and 'rb' to read ?
> >> Am I right?
> > no.
> > you should use "wb" to write *binary* files, and "rb
Steven D'Aprano wrote:
> When you read a Windows text file using "r" mode, what happens to the \r
> immediately before the newline? Do you have to handle it yourself? Or will
> Python cleverly suppress it so you don't have to worry about it?
>
> And when you write a text file under Python using "w
On Mon, 13 Jun 2005 11:53:25 +0200, Fredrik Lundh wrote:
> <[EMAIL PROTECTED]> wrote:
>
>> It means in windows we should use 'wb' to write and 'rb' to read ?
>> Am I right?
>
> no.
>
> you should use "wb" to write *binary* files, and "rb" to read *binary*
> files.
>
> if you're working with *t
<[EMAIL PROTECTED]> wrote:
> It means in windows we should use 'wb' to write and 'rb' to read ?
> Am I right?
no.
you should use "wb" to write *binary* files, and "rb" to read *binary*
files.
if you're working with *text* files (that is, files that contain lines of text
separated by line separa
Peter Hansen wrote:
> (I don't believe there's a "wU" and conceptually it's sort
> of meaningless anyway,
If we ever get quantum computers, presumably "wU" will
write the newlines in all possible formats simultaneously...
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
C
Hello All,
Thanks for the response.
I use mysql and find something strange lately while load text file to
my database table using LINES TERMINATED BY '\r\n',
And I found that mysql think I have '\r\r\n'. this is happened because
in one of my code I use 'w' to write element of string + '\r\n'. no
[EMAIL PROTECTED] wrote:
> It means in windows we should use 'wb' to write and 'rb' to read ?
> Am I right?
There is a conceptual difference between "text" files and other files
(which are lumped under the label "binary").
Binary files have any kind of data in them (bytes from 0 to 255) and no
On 8 Jun 2005 06:44:40 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> It means in windows we should use 'wb' to write and 'rb' to read ?
> Am I right?
It depends what you are trying to do with the file. If you are
processing it as a text file, open it as a text file, and all will be
well:
Hello thanks everyone,
It means in windows we should use 'wb' to write and 'rb' to read ?
Am I right?
pujo
--
http://mail.python.org/mailman/listinfo/python-list
On 8 Jun 2005 06:24:05 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I use windows notepad editor to write text.
>
> For example I write (in d:\myfile.txt):
> Helo
> World
>
> If I open it with python:
> FName = open(d:\myfile.txt,'r')
> h = FName.readlines()
> print h
>
[EMAIL PROTECTED] wrote:
> Hello,
>
> I use windows notepad editor to write text.
>
> For example I write (in d:\myfile.txt):
> Helo
> World
>
> If I open it with python:
> FName = open(d:\myfile.txt,'r')
> h = FName.readlines()
> print h
>
> I get h : ['Helo\n', 'World']
>
> I thought n
"Jake" <[EMAIL PROTECTED]> wrote:
> in c and c++ there is a useful way to refresh an output line in printf
> and cout using \r meta command.
that's a control character that's printed to the terminal by printf/cout,
not a "C or C++ meta command"
to print the same character in Python, use the same
Jake wrote:
> in c and c++ there is a useful way to refresh an output line in printf
> and cout using \r meta command. So for example in the wget application
> the progress of the download is updated on the same output line of the
> screen. From an intital investigation python seems to lack this.
Jake wrote:
> in c and c++ there is a useful way to refresh an output line in printf
> and cout using \r meta command. So for example in the wget application
> the progress of the download is updated on the same output line of the
> screen. From an intital investigation python seems to lack this. I
Hi!
> in c and c++ there is a useful way to refresh an output line in printf
> and cout using \r meta command. So for example in the wget application
> the progress of the download is updated on the same output line of the
> screen. From an intital investigation python seems to lack this. Is
> thi
55 matches
Mail list logo