小编Aru*_*n.K的帖子

用前一行更新记录

我有一种情况,我需要用前一行值更新记录。

来源:

|MatId | BaseId |Flag|Pkg1| CS1
--------------------------------
|3001  | 3001   | 1  | 20 | 2 |
|3002  | 3001   | 0  | 15 | 3 |
|3003  | 3001   | 0  | 10 | 4 |
Run Code Online (Sandbox Code Playgroud)

这里 3001( MatID) 和 3001( BaseID) 是相同的所以FLAG =1,只有在下一条记录中BASEID是相同的。输出应PKG1是使用当前行值更新的字段。

目标或输出:

|MatId | BaseId|Flag|Pkg1|CS1
------------------------------
|3001  | 3001  | 1  | 20 | 2|
|3002  | 3001  | 0  | 20 | 3|
|3003  | 3001 …
Run Code Online (Sandbox Code Playgroud)

sql-server insert-update

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

Python NoneType 对象不可下标

我正在尝试这段代码,并在以 lat、lng 和 location 开头的行中出现错误。有人可以帮忙吗?

import urllib.parse
import urllib.request
import json
while True:
    address = input('Enter location: ')
    if len(address) < 1 : break 
    serviceurl = 'http://python-data.dr-chuck.net/geojson'
    url = serviceurl + '?' + urllib.parse.urlencode({'sensor':'false', 'address':  address})
   response = urllib.request.urlopen(url)
data = response.readall().decode('utf-8')
js = json.loads(str(data))
if 'status' not in js or js['status'] != 'OK':
    print ('==== Failure To Retrieve ====')
    print (data)
    continue
    print (json.dumps(js, indent=4))

    lat = js["results"][0]["geometry"]["location"]["lat"]
    lng = js["results"][0]["geometry"]["location"]["lng"]
    print('lat',lat) #,('lng'),lng
    location = js['results'[0]]['formatted_address']
    print(location)
Run Code Online (Sandbox Code Playgroud)

谢谢,阿伦

python api json

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

日期转换简单日期格式

我需要将日期转换为此格式yyyy.mm.dd,我使用以下公式 -

Date curDate = new Date();
out.println(curDate);
String pattern = "yyyy.mm.dd";

DateFormat format1 = new SimpleDateFormat(pattern, Locale.ENGLISH);
String DateToStr = format1.format(curDate);
out.println(DateToStr);
Run Code Online (Sandbox Code Playgroud)

我得到的输出是

curDate - Fri Feb 05 15:21:28 CST 2016
DateToStr - 2016.21.05
Run Code Online (Sandbox Code Playgroud)

我需要代替2016.21.05,它应该是DateToStr - 2016.02.05.

我在这里做错了什么帮忙?

谢谢,阿伦

java jsp date

-1
推荐指数
1
解决办法
89
查看次数

标签 统计

api ×1

date ×1

insert-update ×1

java ×1

json ×1

jsp ×1

python ×1

sql-server ×1