Your reply is technically more accurate than Paul D Waite's own reply to his question???? And that problem with the separator is probably why I wasn't getting the love.
Thanks for setting me straight. Is that a problem? Thanks — glarrain. It won't be a problem because there's already default paths set up, see sys. Show 4 more comments. To query the variable directly, use: import os os. Vitali Vitali 3, 1 1 gold badge 23 23 silver badges 23 23 bronze badges. For future readers: os. The separator used in the Python path is different, and returned by os. Leon Chang Leon Chang 4 4 silver badges 9 9 bronze badges.
C4rnot C4rnot 51 1 1 bronze badge. Rakend Dubba Rakend Dubba 81 4 4 bronze badges. Sandro Braun Sandro Braun 41 4 4 bronze badges. ZF 3, 8 8 gold badges 30 30 silver badges 45 45 bronze badges.
Diogo Hutner Diogo Hutner 3 1 1 bronze badge. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks. Podcast Making Agile work for data science. Featured on Meta. Asked 11 years, 7 months ago. Active 5 months ago. Viewed k times. Improve this question. Gareth Gareth 2, 4 4 gold badges 17 17 silver badges 20 20 bronze badges.
Add a comment. Active Oldest Votes. This is equivelent to the above: pathlib. Path mydir, myfile or pathlib. Improve this answer. However in the long run the use of os. It also allows you to use mydir and myfile as variables that you can easily modify. You can use os. I like the r raw string syntax.
Useful if you're copying a long path where you'd usually have to replace all the backslashes with forward slashes — peterb. Show 1 more comment. Use the os. Community Bot 1 1 1 silver badge. Lott S. Lott k 75 75 gold badges silver badges bronze badges.
Does that mess up some of cleanliness of using join? JackO'Connor that's what I do. Carlos Delgado Author. Add Your Comment. Become a more social person. Related Articles. How to get the canonical url of a path, actual route and host domain with twig April 09, How to create an hybrid app for desktop html, css and javascript with electron framework in windows March 21,
0コメント