1
我是Python新手,正在尋找一個slug/url參數化庫,它提供了與Ruby Stringex library類似的功能。例如:Python中的高級slug/url參數化(包括音譯)庫
# A simple prelude
"simple English".to_url => "simple-english"
"it's nothing at all".to_url => "its-nothing-at-all"
"rock & roll".to_url => "rock-and-roll"
# Let's show off
"$12 worth of Ruby power".to_url => "12-dollars-worth-of-ruby-power"
"10% off if you act now".to_url => "10-percent-off-if-you-act-now"
# You don't even wanna trust Iconv for this next part
"kick it en Français".to_url => "kick-it-en-francais"
"rock it Español style".to_url => "rock-it-espanol-style"
"tell your readers 你好".to_url => "tell-your-readers-ni-hao"
我遇到了webhelpers.text.urlify,它聲稱要做到這一點,但結果並不接近。任何幫助深表感謝。
謝謝了很多Chewie! – 2012-01-27 12:42:05
我認爲這個代碼**的方式**比strictgex的要差。它甚至不做音譯。例如,「möp」變成「拖把」而不是「moep」。 – ThiefMaster 2014-05-17 22:51:21