On Wed, Nov 25, 2020 at 11:00 AM dn via Python-list <python-list@python.org> wrote:
> On 26/11/2020 05:46, Bob van der Poel wrote: > > I've got a program which accepts an optional env variable listing a > single > > or multiple directory for the app to use. I've done a bit of a search and > > see both a comma and semicolon being used/suggested as a path separator. > > Any consensus on which is better? > > > > MYPATHS=foo,bar,woof > > or > > MYPATHS=foo;bar;woof > > And, certainly not > > MYPATHS=foo,bar;woof > > > > I did think I could be clever and check to see if the string contained a > , > > or ; and spit it accordingly, but then what if the reason (hopefully, > > pretty damned unlikely!) that a , or ; is being used as part of a path > name? > > > Is this a Python question? ie the above code should be run inside the > Python interpreter (it won't). > > MS-Windows has an option to use a comma or a semi-colon as a > list-separator on the 'command line' - as a local/locale definition, but > there are caveats. > > Alternately, did you mean that the above is part of a data-file? > - > Just to clarify, the variable can be set on the command line or in a shell script. Most likely: MYPATH=aa,bb,cc myprogram and myprogram will look for the variable and slice it into chunks at ","s or ";". You're right, this is not really a python question. Probably a shell thing. Thanks. -- **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars **** Bob van der Poel ** Wynndel, British Columbia, CANADA ** EMAIL: b...@mellowood.ca WWW: http://www.mellowood.ca -- https://mail.python.org/mailman/listinfo/python-list