这是我的代码:
class save(BaseRequestHandler):
def get(self):
counter = Counter.get_by_key_name('aa-s')
counter.count += 1
url = "http://www.google.com"
result = urlfetch.fetch(url)
if result.status_code == 200:
counter.ajax = result.content
counter.put()
self.redirect('/')
Run Code Online (Sandbox Code Playgroud)
而错误是:
Traceback (most recent call last):
File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__
handler.get(*groups)
File "F:\ss\Task Queue\main.py", line 48, in get
counter.ajax = result.content
File "D:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 542, in __set__
value = self.validate(value)
File "D:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 2453, in validate
raise BadValueError('Property %s is not multi-line' % self.name)
BadValueError: Property ajax is not …
Run Code Online (Sandbox Code Playgroud) 这是我的代码:
public class a {
public static void main(String[] args) {
String a = "12345aaaa##22";
String b = a[-2:];
System.out.println(b);
}
}
Run Code Online (Sandbox Code Playgroud)
如何使用java获取最后一个字符串'22'
谢谢
这是我的代码:
a=[{'x':'aaa','b':'bbbb'},{'x':'a!!!','b':'b!!!'},{'x':'2222','b':'dddd'},{'x':'ddwqd','b':'dwqd'}]
Run Code Online (Sandbox Code Playgroud)
我希望得到每个'x'列表,如下所示:
['aaa','a!!!','2222','ddwqd']
Run Code Online (Sandbox Code Playgroud)
这是获得这个的最好方法,
用地图?
谢谢
这是我老板的代码:
if hasattr(request, 'rk_user') and request.rk_user:
request.rk_user.focus_update()
Run Code Online (Sandbox Code Playgroud)
但我认为没有必要检查两者
我认为它应该是:
if hasattr(request, 'rk_user') :
request.rk_user.focus_update()
Run Code Online (Sandbox Code Playgroud)
要么:
if request.rk_user:
request.rk_user.focus_update()
Run Code Online (Sandbox Code Playgroud)
我对吗?
这是我的代码:
print dict(range(3),range(3))
Run Code Online (Sandbox Code Playgroud)
但它显示错误:
Traceback (most recent call last):
File "c.py", line 7, in <module>
print dict(range(3),range(3))
TypeError: dict expected at most 1 arguments, got 2
Run Code Online (Sandbox Code Playgroud)
我能做什么 ,
谢谢
这是我的代码:
attackUp = [10, 15,10, 15,10, 15]
defenceUp = [10, 15,10, 15,10, 15]
magicUp = [10, 15,10, 15,10, 15]
attType = [1,1,1,1,1,1]
weightDown = [10, 15,10, 15,10, 15]
#?????
accAttackSword = [100, 100,100, 100,100, 100]
accAttackSaber = [100, 100,100, 100,100, 100]
accAttackAx = [100, 100,100, 100,100, 100]
accAttackHammer = [100, 100,100, 100,100, 100]
accAttackSpear = [100, 100,100, 100,100, 100]
accAttackFight = [100, 100,100, 100,100, 100]
accAttackBow = [100, 100,100, 100,100, 100]
accAttackMagicGun = [100, 100,100, 100,100, 100]
accAttackMagic = [100, …
Run Code Online (Sandbox Code Playgroud) 这是我的代码:
from math import ceil
a = 25
a = float(a/10)
a = int(ceil(a))*10
print a
Run Code Online (Sandbox Code Playgroud)
我得到20,但我想要30,
接下来是我想要的:
if the a is 22 , i want get 20
if the a is 25 , i want get 30
if the a is 27 , i want get 30
if the a is 21 , i want get 20
Run Code Online (Sandbox Code Playgroud)
那我该怎么办
谢谢
这是我的代码:
def a():
print aa
def b():
aa = 'aaaa'
a()
b()
Run Code Online (Sandbox Code Playgroud)
它显示错误:
Traceback (most recent call last):
File "g.py", line 12, in <module>
b()
File "g.py", line 10, in b
a()
File "g.py", line 6, in a
print aa
NameError: global name 'aa' is not defined
Run Code Online (Sandbox Code Playgroud)
在aa
必须在B函数来定义,
我能做什么 ,
谢谢
这是我的代码:
a = [1,2,3,43,43,43]
count = a.count(43)
if count > 0:
for i in range(count):
a.remove(43)
print a
Run Code Online (Sandbox Code Playgroud)
有没有更简单的方法来实现这一目标?
a只允许包含0 1 2,
a=[0,1,2]#a's max size
if a=[0,] a += [1] --> [0,1]
if a=[0,1] a += [1] --> [0,1]
if a=[0,1] a += [2] --> [0,1,2]
if a=[0,1,2] a += [1] --> [0,1,2]
if a=[0,1,2] a += [4] --> [0,1,2]
Run Code Online (Sandbox Code Playgroud)
所以我能做些什么