Question: how could I join to URL list path parts?
オープン
question
- 主要言語
- Python
- スター
- 1.5k
- フォーク
- 215
- 平均マージ
- 1日 2分
- マージ済み PR(30日)
- 13
説明
Assume I have an URL `URL('http://localhost:5984/base')` and some list of path segments like `['foo', '/bar', 'baz%']`. What's the proper way to join them to url to have`URL(http://localhost:5984/base/foo/%2fbar/baz%25)` as result?
So far I came to:
```
url = URL('http://localhost:5984/base')
segments = ['foo', '/bar', 'baz%']
for seg in sements:
url /= seg.replace('/', '%2F')
```
But that doesn't looks like good solution. Or it does?
コントリビューションガイド
評価
この issue はまだ評価されていません。