我想在谷歌地理编码api中使用一个字符串.我检查了很多线程,但我仍然面临问题,我不明白如何解决它.
我需要addresse1成为一个没有任何特殊字符的字符串.例如,Addresse1是:"32 rue d'AthènesParisFrance".
addresse1= collect.replace(' ','+').replace('\n','')
addresse1=unicodedata.normalize('NFKD', addresse1).encode('utf-8','ignore')
Run Code Online (Sandbox Code Playgroud)
在这里我得到了一个没有任何重音的字符串...... Ho no ...它不是字符串而是字节.所以我完成了建议和'解码:
addresse1=addresse1.decode('utf-8')
Run Code Online (Sandbox Code Playgroud)
但是,然后addresse1与开始时完全相同......我该怎么办?我究竟做错了什么?或者unicode我不明白的是什么?或者有更好的解决方案吗?
谢谢,
斯特凡.
这是我的终端在尝试安装Django时所说的.
MacBook-XXXX:~ Stephane$ sudo pip install Django
sudo: pip: command not found
Run Code Online (Sandbox Code Playgroud)
如果安装了pip,我已在idle shell中测试过:
>>> import easy_install
>>> import pip
>>>
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我为 Scrabble 编写了一个简单的搜索应用程序。从字符串中找出所有可能的单词。置换部分完成。我创建了一个函数 Permute(string) ,它输出一个包含所有排列的数组。
var dictionary=["abc","abcd",ab","dhgd","adbft"];
var input="abcd";
output=Permute(input);
//result:
0:"abcd"
1:"abdc"
2:"acbd"
3:"acdb"
4:"adbc"
5:"adcb"
...etc
Run Code Online (Sandbox Code Playgroud)
现在,我必须检查单词是否存在。我应该尝试所有长度吗?还有其他更有效的方法吗?
//Check all the item of the output array
for(var i=0; i<output.length;i++){
//Check if all length of output
for(var j=2;j<output[i].length;i++)
//Check all these possibilities if they exist in the dictionary
for(word in dictionary){
output[i].substring[1:j]==dictionary[word];
}
}};
Run Code Online (Sandbox Code Playgroud)
我真的无法想象如果字典是 250 000 个单词会多长时间......有没有更好的方法?
我是法国人。法语中,问号“?”前后必须有空格。但是,根据屏幕的大小,有时会出现“?”。下一行在线。如何防止这种丑陋的显示?
\n\n我无法在问题中添加标签,因为它们是绑定的。
\n\n<div class="row">\n <div class="col-md-8 col-md-offset-2">\n <div class="errorbox text-left">\n <p></p>\n <ul>\n <li>Question 1 ? </li>\n <li>Question 2 ? </li>\n <li>Question 3 ? </li>\n </ul>\n </div>\n </div>\n</div>\n
Run Code Online (Sandbox Code Playgroud)\n\n谢谢,
\n\nSt\xc3\xa9phane。
\n