On Sun, Apr 2, 2017 at 7:49 AM, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > Chris Angelico <ros...@gmail.com> writes: >>Yes it can; however, there is no way within Python to have a string >>that can represent two strings, which is what directory separators do. > > To represent two strings, /internally/ ("within Python"), > a straightforward way would be a list of two strings. > > If one wants to represent this list /as a single string/, > one can use any serialization of this list, for example, > using JSON. > > (I have not read the whole thread, so I might have missed > some context here. I am just responding to what is quoted > above.)
The context is a file name, in which you need something that a user can input which is capable of representing path components that contain arbitrary characters. Currently, a Unix path always interprets a slash as a directory separator, so there's no way to have a slash in a file or directory name. If you want to have *every* component capable of containing *any* character, you either need a string to be able to represent two strings, or you need some sort of escaping mechanism. ChrisA -- https://mail.python.org/mailman/listinfo/python-list