给定一个矩形Selection,如何找到Cell每个角的s?具体来说,右上角和左下角.
例如,如果用户选择范围B2:G9,我想从Selection对象获得每个角落的地址.
我曾经.Address得到左上角和右下角,虽然我可以开始拆分字符串并执行正则表达式替换它们我想知道是否有更清洁的方法.
我正在尝试从文件中逐行导入一些数据。我要读取的一个特定行末尾可能有也可能没有“kB”(千字节),我想解析这一行中的双精度数,但我的程序给了我 java.lang.NumberFormatException。
while(inputStream.hasNextLine())
{
inputStream.nextLine(); // Skips a line between each object
String sn = inputStream.nextLine();
String sa = inputStream.nextLine();
double ss = Double.parseDouble(inputStream.nextLine()); // This is where the problem occurs
int sd = Integer.parseInt(inputStream.nextLine());
addSong(sn, sa, ss, sd); // Send the four variables for Song() to the addSong method
}
inputStream.close();
Run Code Online (Sandbox Code Playgroud)
我有一种感觉,我可以在这里使用indexOf(),但我不确定如何使用。
干杯!
JSON
<script>
var data2sales=
[{
"key": "Owners",
"bar": true,
"values": [
[1490400000000, 1591, "", "", ""],
[1490486400000, 1924, "#2B6A94", "", ""],
[1490572800000, 1982, "", "", ""],
[1490659200000, 1606, "", "", ""]]
}]
</script>
Run Code Online (Sandbox Code Playgroud)
我在 Python 中获取 Json 的代码
notices = str(soup.select('script')[30])
split_words=notices.split('var data2sales= ')
split_words=split_words[1]
temp=split_words[44:689]
temp = 'var data2sales= {' +temp + '}'
print(temp)
newDict = json.loads((temp))
print(newDict)
Run Code Online (Sandbox Code Playgroud)
我是 Python 中 BeautifulSoup 的新手,我正在尝试dict从 BeautifulSoup 中提取一个。正如你在我的代码中看到的,我用 python 重新制作了 JSON 代码并保存在 newDict 变量中。但它不起作用。有没有人可以教我,我怎样才能提取那个 JSON 代码?谢谢你。