//col[@ColName="班次信息"][text()="null"]中还有其他的写法嘛
时间: 2024-06-07 15:09:37 浏览: 12
是的,还有其他的写法,例如:
- //col[@ColName="班次信息"][not(text())]
- //col[@ColName="班次信息"][text()='']
- //col[@ColName="班次信息"][normalize-space(text())='']
这些写法都可以选取所有具有 ColName 属性值为 "班次信息",且文本内容为空或只包含空格的 col 元素。其中,not(text()) 表示文本内容不存在,text()=' ' 表示文本内容为一个空格,normalize-space(text())=' ' 表示将文本内容中的空格字符(包括换行符、制表符等)都去掉后,判断是否为空格。
相关问题
优化这个布局<view class="box"> <uni-row class="demo-uni-row"> <uni-col :span="12"> <view class="boxnormal"> <text class="normaltext">正常气罐\n</text> <text class="normalSize">{{normalNumber}}</text> </view> </uni-col> <uni-col :span="12"> <view> <view class="warning"> <text class="warningtext">预警</text> <text class="warningSize">{{warningNumber}}</text> </view> <view class="error"> <text class="errortext">警告</text> <text class="errorSize">{{errorNumber}}</text> </view> </view> </uni-col> </uni-row> </view>
可以通过以下方式对这个布局进行优化:
1. 使用flex布局代替uni-row和uni-col布局,可以减少代码量,提高布局效率。
```
<view class="box">
<view class="boxnormal">
<text class="normaltext">正常气罐</text>
<text class="normalSize">{{normalNumber}}</text>
</view>
<view class="warning">
<text class="warningtext">预警</text>
<text class="warningSize">{{warningNumber}}</text>
</view>
<view class="error">
<text class="errortext">警告</text>
<text class="errorSize">{{errorNumber}}</text>
</view>
</view>
.box {
display: flex;
justify-content: space-between;
}
.boxnormal {
display: flex;
flex-direction: column;
align-items: center;
}
.warning, .error {
display: flex;
flex-direction: column;
align-items: center;
}
.warning {
background-color: #f5a623;
}
.error {
background-color: #f44336;
}
```
2. 将重复的样式封装成class,减少重复代码。
```
<view class="box">
<view class="boxnormal normal">
<text class="normaltext">正常气罐</text>
<text class="normalSize">{{normalNumber}}</text>
</view>
<view class="warning normalSize warningSize">预警 {{warningNumber}}</view>
<view class="error normalSize errorSize">警告 {{errorNumber}}</view>
</view>
.box {
display: flex;
justify-content: space-between;
}
.normal {
display: flex;
flex-direction: column;
align-items: center;
}
.warning {
background-color: #f5a623;
}
.error {
background-color: #f44336;
}
```
brand2 = response.xpath('//p[@class="col col1"]/text()').extract() brand = [] for j in brand2: areatemp = j.strip('品牌:').strip('排量:').strip('\r\n') print(areatemp) brand.append(areatemp) brand = [i for i in brand if i != '']
这是一个Python代码片段,它使用XPath从网页中提取文本,并将提取的文本处理为一个品牌列表。代码的功能是将一个包含品牌和排量信息的文本字符串列表转换为仅包含品牌信息的列表。具体来说,它使用strip()方法去除字符串中的特定子字符串,并使用循环将处理后的品牌添加到新列表中。最后,它使用列表解析式去除列表中的空字符串。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
請你幫我打修改HTML代碼<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>异常记录</title> <style> .main { display: flex; flex-direction: row; justify-content: space-between; align-items: center; } </style> </head> <body> 首页 登记数据 查询数据 异常记录登记 <form method="post" action="/submit"> <label>确认线别:</label> <input type="text" name="line">
<label>确认日期:</label> <input type="date" name="date">
<label>异常机种:</label> <input type="text" name="model">
<label>异常现象:</label> <textarea name="issue"></textarea>
<label>生产日期:</label> <input type="date" name="prod_date">
<label>生产班别:</label> <input type="text" name="shift">
<label>生产线别:</label> <input type="text" name="prod_line">
<label>责任人:</label> <input type="text" name="responsible">
<input type="submit" value="提交"> </form> 欢迎访问 </body> </html>
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)