小编slo*_*ope的帖子

如何从python中的字符串中删除此\ xa0?

我有以下字符串:

 word = u'Buffalo,\xa0IL\xa060625'
Run Code Online (Sandbox Code Playgroud)

我不希望那里有"\ xa0".我怎么能摆脱它?我想要的字符串是:

word = 'Buffalo, IL 06025
Run Code Online (Sandbox Code Playgroud)

python unicode

9
推荐指数
4
解决办法
3万
查看次数

在回调中调用yield时,redux saga给了我一个例外,为什么?

所以我注释掉了它给我回溯的地方。

export function* watchFileReader(){
const action = yield take("DROP_FILE")
console.log('action', action)
let file = action.file[0];
readFile(file, function(e){
  sessionStorage.removeItem('img')
  console.log('alskdjfalsdjkf', e.target.result)
  sessionStorage.setItem('img', e.target.result)
  // yield put({type: "UDATE", {img: e.target.result})
   })
}
Run Code Online (Sandbox Code Playgroud)

更新:这是我承诺的使代码起作用的功能。

 function readFileWithPromise(file){
  return new Promise((resolve, reject) => {
   readFile(file, function(e){
     if (e){
      resolve(e)
     }else{
      reject(e)
     }
   })
 })
}
Run Code Online (Sandbox Code Playgroud)

javascript asynchronous redux redux-saga

4
推荐指数
1
解决办法
1192
查看次数

如何在材料ui中文本包装菜单项.

所以我需要在popover中显示一个文本.我有以下代码使文本出现在一行中.我需要将文本换行以将它们放在多行中,但是我认为原因但到目前为止我的更新还没有成功.任何的想法?

                            <Popover
                                anchorEl={target}
                                open={open}
                                anchorOrigin={{horizontal: 'middle', vertical: 'bottom'}}
                                targetOrigin={{horizontal: 'left', vertical: 'bottom'}}
                                onRequestClose={handleRequestClose}
                                animation={PopoverAnimationVertical}>
                                <Menu
                                    autoWidth={true}
                                    >
                                    <MenuItem style={{width: "200px",   height: "200px"}}>  
                                       <p style={{display: "flex", flexWrap: "wrap"}}>'aslkjflajdsljflskdjflsdfjlsjdfjdfjlasjkfadlsf'</p> 
                                     </MenuItem> //this does not work....
                                </Menu>
Run Code Online (Sandbox Code Playgroud)

material-ui

3
推荐指数
1
解决办法
4412
查看次数

如何用 urlparse 中的新值替换查询?

所以我有一个数据如下:

 item = '//s780.scene7.com/is/image/forever/301596014_001?hei=98&wid=98'
Run Code Online (Sandbox Code Playgroud)

使用 urlparse 模块。我怎样才能用新的大小替换上面的数据,使它看起来像这样:

  item = '//s780.scene7.com/is/image/forever/301596014_001?hei=360&wid=360'
Run Code Online (Sandbox Code Playgroud)

python urlparse scene7

2
推荐指数
1
解决办法
2430
查看次数

如何基于列表中的索引创建两个新列表?

所以我认为如果我展示一个例子就更容易解释:

things = ["black", 7, "red', 10, "white", 15] 
Run Code Online (Sandbox Code Playgroud)

两个基于索引是偶数还是奇数的新列表.

color = ["black", "red","white"]
size = [7,10,15]
Run Code Online (Sandbox Code Playgroud)

python

0
推荐指数
1
解决办法
36
查看次数