On Thursday 05 July 2018 11:57:18 Mikhail V wrote:
> Steven D'Aprano wrote:
> > In Explorer and the open-file dialog of most applications, they will
> > see paths like this:
> >
> > directory\file name with spaces
> >
> > with the extension (.jpg, .pdf, .docx etc) suppressed. So by your
> > ar
Steven D'Aprano wrote:
> In Explorer and the open-file dialog of most applications, they will see
> paths like this:
>
> directory\file name with spaces
>
> with the extension (.jpg, .pdf, .docx etc) suppressed. So by your
> argument, Python needs to accept strings without quotes:
>
> open
On Thu, 05 Jul 2018 00:56:22 +0300, Mikhail V wrote:
> for the user it is most important to
> *see* and copy-paste the path string exactly as it is displayed
> everywhere else on windows.
So in Windows, you see:
dir directory\file.pdf
so in Python, we have to use exactly the same path with
Mikhail V wrote:
There is one issue that I can't write \ on the end:
r"C:\programs\util\"
But since I know it's a path and not a file, I just write without trailing \.
Indeed. There's never a need to put a backslash on the end of
a path, as long as you always use os.path functions or
equivalen
ChrisA wrote:
> Mikhail V wrote:
>> Yes, and the answer was a week ago: just put "r" before the string.
>> r"C:\programs\util"
>>
>> And it worked till now. So why should I replace backslashes with
>> forward slashes?
>> There is one issue that I can't write \ on the end:
>> r"C:\programs\util\"
On 04/07/18 21:30, Chris Angelico wrote:
On Thu, Jul 5, 2018 at 6:25 AM, Mikhail V wrote:
Joe Pfeiffer wrote:
On Windows a path is e.g.:
C:\programs\util\
So what is reasonable about using forward slashes?
It happens to me that I need to copy-paste real paths like 100 times
a day into scripts
On Thu, Jul 5, 2018 at 6:25 AM, Mikhail V wrote:
> Joe Pfeiffer wrote:
>
>>> On Windows a path is e.g.:
>>> C:\programs\util\
>>> So what is reasonable about using forward slashes?
>>> It happens to me that I need to copy-paste real paths like 100 times
>>> a day into scripts - do you propose to c
Joe Pfeiffer wrote:
>> On Windows a path is e.g.:
>> C:\programs\util\
>> So what is reasonable about using forward slashes?
>> It happens to me that I need to copy-paste real paths like 100 times
>> a day into scripts - do you propose to convert to forward slashes each time?
> That's what starte
Mikhail V writes:
> [Steven D'Aprano]
>
>> (The same applies to Unix/Linux systems too, of course.) But while you're
>> using Python to manipulate files, you should use Python rules, and that
>> is "always use forward slashes".
>>
>> Is that reasonable?
>>
>> Under what circumstances would a user
On 2018-07-03 14:06, Mikhail V wrote:
> Greg wrote:
>
>> Mikhail V wrote:
>>> s= "\"s\"" ->
>>> s= {"s"}
>>
>> But now you need to find another way to represent set literals.
>
>
> I need to find? That comment was not about (current) Python but
> rather how I think string should have been
Greg wrote:
> Mikhail V wrote:
> > s= "\"s\"" ->
> > s= {"s"}
>
> But now you need to find another way to represent set literals.
I need to find? That comment was not about (current) Python but
rather how I think string should have been from the beginning.
So you already like it and want
Mikhail V wrote:
s= "\"s\"" ->
s= {"s"}
But now you need to find another way to represent set literals.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
[Chris A]
> [Mikhail]
> > So Imo default syntax should be something like:
> >
> > S = "A:{x41}B:{x42}"
> >
> > instead of backslashes and Co.
>
> So how do you represent brace characters in a string?
\{ and \}
just kidding :-D
I would be ok with {L} and {R} - easy on eye and easy to rememb
On 2018-07-02 18:16, Richard Damon wrote:
On 7/2/18 9:20 AM, Mikhail V wrote:
[Richard Damon]
The one major issue with backslashes is that they are a special
character in string literals, so you either need to use raw literals a
remember the few cases they still act as special characters, or r
On 7/2/18 9:20 AM, Mikhail V wrote:
> [Richard Damon]
>
>> The one major issue with backslashes is that they are a special
>> character in string literals, so you either need to use raw literals a
>> remember the few cases they still act as special characters, or remember
>> to convert them to doub
On Tue, Jul 3, 2018 at 2:20 AM, Mikhail V wrote:
> [Richard Damon]
>
>> The one major issue with backslashes is that they are a special
>> character in string literals, so you either need to use raw literals a
>> remember the few cases they still act as special characters, or remember
>> to conver
[Richard Damon]
> The one major issue with backslashes is that they are a special
> character in string literals, so you either need to use raw literals a
> remember the few cases they still act as special characters, or remember
> to convert them to double back slashes, at a minimum for all the
>
Eryk,
thanks for your to-the-point in-depth posts.
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Jul 1, 2018 at 4:30 PM, eryk sun wrote:
> On Sun, Jul 1, 2018 at 8:51 AM, Steven D'Aprano
>
>> spam/eggs
[...]
>> And how would that file be displayed in the Windows GUI file explorer?
>
> I suppose if a file system allowed forward slash in names that
> Explorer would just display it.
eryk sun wrote:
Python 2 raw strings are half-baked.
Obviously the "r" actually stand for "rare".
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Jul 1, 2018 at 4:00 PM, Abdur-Rahmaan Janhangeer
wrote:
> one common scenario is
>
> C:\Users\
>
> where \U is taken as a unicode litteral
This one is especially annoying in Python 2, since it makes raw
unicode strings useless for common path literals. For example:
>>> ur'C:\User
On Sun, Jul 1, 2018 at 8:51 AM, Steven D'Aprano
wrote:
> On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote:
>
>> Bear in mind that forward slash is just a name character in NT.
>
> So, using Python, how could you open, write to, and then read from, a
> file with a slash in its name? Say, somethi
one common scenario is
C:\Users\
where \U is taken as a unicode litteral
Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ
>
>
>
--
https://mail.python.org/mailman/listinfo/python-list
On 7/1/18 6:49 AM, Mikhail V wrote:
> [Steven D'Aprano]
>
>> (The same applies to Unix/Linux systems too, of course.) But while you're
>> using Python to manipulate files, you should use Python rules, and that
>> is "always use forward slashes".
>>
>> Is that reasonable?
>>
>> Under what circumstan
[Steven D'Aprano]
> (The same applies to Unix/Linux systems too, of course.) But while you're
> using Python to manipulate files, you should use Python rules, and that
> is "always use forward slashes".
>
> Is that reasonable?
>
> Under what circumstances would a user calling open(pathname) in Pyt
On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote:
> Bear in mind that forward slash is just a name character in NT.
So, using Python, how could you open, write to, and then read from, a
file with a slash in its name? Say, something like:
spam/eggs
in your home directory. (Is that still
26 matches
Mail list logo