求助 Python报错 TypeError: rank() got an unexpected keyword argument 'numeric_only'

import numpy
import pandas
import matplotlib
#http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-levenshtein
import Levenshtein
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from mpl_toolkits.basemap import Basemap
from matplotlib.collections import PatchCollection

font = {
'family' : 'SimHei'
};
matplotlib.rc('font', **font);

fig = plt.figure()
ax = fig.add_subplot(111)

basemap = Basemap(
llcrnrlon=73.55770111084013,
llcrnrlat=18.159305572509766,
urcrnrlon=134.7739257812502,
urcrnrlat=53.56085968017586
)

chinaAdm1 = basemap.readshapefile(
'D:\PDA\6.6\china\CHN_adm1',
'china'
)

data = pandas.read_csv(
'D:\PDA\6.6\province.csv',
sep="\t"
)

data['总人口'] = data.总人口.str.replace(",", "").astype(int)

data['scala'] = (
data.总人口-data.总人口.min()
)/(
data.总人口.max()-data.总人口.min()
)

#数据处理:如何把JSON格式的数据,转换称为Data Frame的格式化数据
mapData = pandas.DataFrame(basemap.china_info)

#字段匹配第二大招:模糊匹配,从列表中,匹配出最大匹配度的项作为匹配项
def fuzzyMerge(df1, df2, left_on, right_on):
suitSource=[]
suitTarget=[]
suitRatio=[]

df2 = df2.groupby(
    right_on
)[right_on].agg({
    right_on: numpy.size
})

df2[right_on] = df2.index

for df1Index, df1Row in df1.iterrows():
    for df2Index, df2Row in df2.iterrows():
        if Levenshtein.ratio(df2Row[right_on], df1Row[left_on])!=0:
            suitSource.append(df1Row[left_on])
            suitTarget.append(df2Row[right_on])
            suitRatio.append(Levenshtein.ratio(df2Row[right_on], df1Row[left_on]))

suitDataFrame = pandas.DataFrame({
    right_on: suitTarget,
    'suitRatio':suitRatio,
    'suitSource':suitSource
})

suitDataFrame = suitDataFrame.drop_duplicates();

suitDataFrame = suitDataFrame.sort_values(
    ['suitSource', 'suitRatio'], 
    ascending=[1, 0]
)

rnColumn = suitDataFrame.groupby(
    'suitSource'
).rank(
    method='first', 
    numeric_only=True, # TypeError 报错
    ascending=False
)
suitDataFrame['rn'] = rnColumn;

suitDataFrame = suitDataFrame[suitDataFrame.rn==1]

data = df1.merge(
    suitDataFrame, 
    left_on=left_on, 
    right_on="suitSource"
)

del data['rn'];
del data['suitRatio'];
del data['suitSource'];

return data;

fData = fuzzyMerge(data, mapData, '地区', 'NL_NAME_1')

def plotProvince(row):
mainColor = (42/256, 87/256, 141/256, row['scala']);
patches = []
for info, shape in zip(basemap.china_info, basemap.china):

if info['NL_NAME_1']==row['NL_NAME_1']:
patches.append(Polygon(numpy.array(shape), True))
ax.add_collection(
PatchCollection(
patches, facecolor=mainColor,
edgecolor=mainColor, linewidths=1., zorder=2
)
)

fData.apply(lambda row: plotProvince(row), axis=1)

dataLoc = pandas.read_csv('D:\PDA\6.6\provinceLoc.csv');

def plotText(row):
plt.text(row.jd, row.wd, row.city, fontsize=14, fontweight='bold', ha='center',va='center',color='r')

dataLoc.apply(lambda row: plotText(row), axis=1)

plt.show()

图片说明
图片说明

2个回答

我自己查了两天资料了,都没找到哪里出了问题,求高手帮忙看下,非常感谢!

rnColumn=pandas.Series(rnColumn).rank(method='first',numeric_only=True,ascending=False),这样就可以解决问题啦

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
TypeError: variable() got an unexpected keyword argument 'constraint'
在GitHub上下载的代码,运行下面错误:rnTraceback (most recent call last):rn File "D:/PythonSpace/Experiment/FgSegNet-master01/FgSegNet/FgSegNet.py", line 228, in rn train(results, scene, mdl_path, log_dir, vgg_weights_path)rn File "D:/PythonSpace/Experiment/FgSegNet-master01/FgSegNet/FgSegNet.py", line 143, in trainrn model = model.initModel()rn File "D:\PythonSpace\Experiment\FgSegNet-master01\FgSegNet\FgSegNetModule.py", line 85, in initModelrn vgg_layer_output = self.VGG16(input_1)rn File "D:\PythonSpace\Experiment\FgSegNet-master01\FgSegNet\FgSegNetModule.py", line 27, in VGG16rn x = Conv2D(64, (3, 3), activation='relu', padding='same', name='block1_conv1', data_format='channels_last')(x)rn File "C:\Program Files\Python35\lib\site-packages\keras\engine\topology.py", line 576, in __call__rn self.build(input_shapes[0])rn File "C:\Program Files\Python35\lib\site-packages\keras\layers\convolutional.py", line 134, in buildrn constraint=self.kernel_constraint)rn File "C:\Program Files\Python35\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapperrn return func(*args, **kwargs)rn File "C:\Program Files\Python35\lib\site-packages\keras\engine\topology.py", line 400, in add_weightrn constraint=constraint)rnTypeError: variable() got an unexpected keyword argument 'constraint'rnrn TypeError: variable() got an unexpected keyword argument 'constraint'rn运行环境:Python3.5、TensorFlow-gpu1.4、keras2.06rn本人部署完代码后,一直报这个错误,不知道什么原因?rn哪位大神能指点一二?rn
got an unexpected keyword argument
如题,本来是head first python里面的一道例题,没有给答案,但是给了修改的思路,系统是win,py版本是3.4最新的rnrn要求是:改后print_lol(),改with从句,然后让man_data.txt的内容变成一行一行的列出(现在只有一行)rnrn源码:rn[code=python]rnman=[]rnother=[]rnrntry:rn data=open('sketch.txt')rn for each_line in data:rn try:rn (role,line_spoken)=each_line.split(':',1)rn line_spoken=line_spoken.strip()rn if role=='Man':rn man.append(line_spoken)rn elif role=='Other Man':rn other.append(line_spoken)rn except ValueError:rn passrn data.close()rnrnexcept IOError:rn print('The data file is missing')rnrnimport nesterrnrntry:rn with open('man_data.txt',"w") as man_file:rn nester.print_lol(man, file=man_file)rn with open('other_data.txt',"w") as other_file:rn nester.print_lol(other, file=other_file)rnrnexcept IOError:rn print('File error:'+str(err))rn[/code]rnrnrnrn其中,nester模块内容为:rn[code=python]import sysrndef print_lol(the_list,indent=False,level=0,fh=sys.stdout):rn for each_item in the_list:rn if isinstance(each_item,list):rn print_lol(each_item,indent,level+1,fh)rn else:rn if indent:rn for tab_stop in range(level):rn print('\t',end='',file=fh)rn print(each_item,file=fh)rn[/code]rnrn错误提示:rn[code=python]Traceback (most recent call last):rn File "E:\05.程序\py\44.py", line 28, in rn nester.print_lol(man, file=man_file)rnTypeError: print_lol() got an unexpected keyword argument 'file'[/code]rnrn是print_lol()使用错误吗?因为print_lol()是给了的,我改了with从句的print改成print_lol
python ——pyecharts—— unexpected keyword argument 'title'?
![图片说明](https://img-ask.csdn.net/upload/201907/25/1563988251_67389.png)rn这是哪个参数错了呢
python——导入excel报错( TypeError)
经过一段时间折腾linux和python环境安装,开始初次学习python 代码如下: 报错如下: 代码与原代码完全一致,暂时没有找到原因
分页报错(typeerror:page() missing 1 required positional argument:'number')
[code=python]rnfrom django.core.paginator import Paginator,PageNotAnInteger,EmptyPage;rn@login_requiredrndef guest_manage(request):rn username = request.session.get("user","");rn guest_list = Guest.objects.all();rn pagintor = Paginator(guest_list,2);rn page = request.GET.get("page");rn try:rn contacts = Paginator.page(page);rn except PageNotAnInteger:rn contacts = paginator.Page(1);rn except EmptyPage:rn contacts = paginator.page(paginator.num_pages);rn return render(request,"guest_manage.html","user":username,"guests":contacts);rn[/code]rn运行报这个错:typeerror:page() missing 1 required positional argument:'number'rn大神们帮忙看看呢
python中绘制世界地图TypeError: argument of type 'Key' is not iterable。
按网上说的,都安装了。运行时一直报错:TypeError: argument of type 'Key' is not iterable。rn在网上下载的也是TypeError: argument of type 'Key' is not iterable。rn请大神分析下,谢谢!rnrn代码一:rn```rnimport pygal_maps_world.mapsrnrnwm = pygal_maps_world.maps.World()rnwm.title = 'North, Central, and South America'rnrnwm.add('North Amerca',['ca', 'mx', 'us'])rnwm.add('Central America',['bz', 'cr', 'gt', 'hn', 'ni', 'pa', 'sv'])rnwm.add('South America',['ar', 'bo', 'br', 'cl', 'co', 'ec', 'gf', 'gy', 'pe',rn 'py', 'sr', 'uy', 've'])rnrnwm.render_to_file('americas.svg')rn```rn代码二rnrn```rnimport pygalrnrnrnwm = pygal.maps.world.World()rnwm.title = 'Populations of Countries in North America'rnwm_key = 'ca':34126000, 'mx':113423000, 'us':309349000rnwm.add('North America',wm_key)rnrnrnwm.render_to_file('na_populations.svg')rn```
【Python 学习笔记】文件写入时遇到 TypeError 报错
在一个简单的文件写入之后: fileOBJ = open("text1.txt","wb") fileOBJ.write("It is just a text.\n") fileOBJ.close() 我遇到了 TypeError 类型的报错: Traceback (most recent call last): File "text.py", line 5, in
Python报错TypeError 'object' is not callable 如何解决?
主程序mcc.py代码如下:rn[code=python]rn#coding=utf-8rnimport timernimport sysrnfrom utils.mailHelper import mailHelperrnfrom utils.excutor import executorrnfrom utils.configReader import configReaderrnreload(sys)rnsys.setdefaultencoding('utf-8')rnrnclass MCC(object):rn CONFIGPATH='_config.ini'rn KEY_COMMAND='Command'rn KEY_OPEN='Open'rn KEY_BOSS='Boss'rn KEY_TIMELIMIT='timelimit'rnrn def __init__(self):rn self.mailHelper=mailHelper()rn self.configReader=configReader(self.CONFIGPATH)rn commandDict=self.configReader.getDict(self.KEY_COMMAND)rn openDict=self.configReader.getDict(self.KEY_OPEN)rn self.timelimit=int(self.configReader.readConfig(self.KEY_BOSS,self.KEY_TIMELIMIT))rn self.excutor=executor(commandDict,openDict)rn self.toRun()rnrn def toRun(self):rn while True:rn self.run()rn time.sleep(self.timelimit)rnrn def run(self):rn mailBody=self.mailHelper.acceptMail()rn if mailBody:rn exe=self.mailHelper.analysisMail(mailBody)rn if exe:rn self.excutor.execute(exe)rnrnif __name__=='__main__':rn mcc=MCC()rn[/code]rn注:这是在网上学的一个通过收发邮件控制电脑完成简单命令的程序代码rn其他模块代码:rnconfigReader.pyrn[code=python]rn# coding=utf-8rnimport ConfigParserrnimport os,sysrnrnclass configReader(object):rn def __init__(self,configPath):rn configFile=os.path.join(sys.path[0],configPath)rn self.cReader=ConfigParser.ConfigParser()rn self.cReader.read(configFile)rnrn def readConfig(self,section,item):rn return self.cReader.get(section,item)rnrn def getDict(self,section):rn commandDict=rn items=self.cReader.items(section)rn for key,value in items:rn commandDict[key]=valuern return commandDictrn[/code]rnrnexcutor.pyrn[code=python]rn#coding=utf-8rnimport osrnimport mailHelperrnimport win32apirnfrom utils.mccLog import mccLogrnclass executor(object):rn def __init__(self,commandDict,openDict):rn self.mccLog=mccLog()rn self.mailHelper=mailHelper()rn self.commandDict=commandDictrn self.openDict=openDictrnrn def execute(self,exe):rn subject=exe['subject']rn self.mccLog.mccWriteLog(u'开始处理命令。')rn self.mailHelper.sendMail('pass','Slave')rn if subject in self.commandDict:rn self.mccLog.mccWriteLog(u'执行命令')rn try:rn command=self.commandDict[subject]rn os.system(command)rn self.mailHelper.sendMail('Success','Boss')rn self.mccLog.mccWriteLog(u'执行命令成功')rn except Exception,e:rn self.mccLog.mccError(u'执行命令失败'+str(e))rn self.mailHelper.sendMail('error','Boss',e)rn elif subject in self.openDict:rn self.mccLog.mccWriteLog(u'打开文件')rn try:rn openFile=self.openDict[subject]rn win32api.ShellExecute(0,'open',openFile,'','',1)rn self.mailHelper.sendMail('Success','Boss')rn self.mccLog.mccWriteLog(u'打开文件成功')rn except Exception,e:rn self.mccLog.mccError(u'打开文件失败'+str(e))rn self.mailHelper.sendMail('error','Boss',e)rn else:rn self.mailHelper.sendMail('error','boss','no such command')rn[/code]rnrnmailHelper.pyrn[code=python]rn#coding=utf-8rnfrom email.mime.text import MIMETextrnfrom configReader import configReaderrnfrom mccLog import mccLogrnimport poplibrnimport smtplibrnimport rernrnclass mailHelper(object):rn CONFIGPATH='_config.ini'rnrn def __init__(self):rn self.mccLog=mccLog()rn cfReader=configReader(self.CONFIGPATH)rn self.pophost=cfReader.readConfig('Slave','pophost')rn self.smtphost=cfReader.readConfig('Slave','smtphost')rn self.port=cfReader.readConfig('Slave','port')rn self.username=cfReader.readConfig('Slave','username')rn self.password=cfReader.readConfig('Slave','password')rn self.bossMail=cfReader.readConfig('Boss','mail')rn self.loginMail()rn self.configSlaveMail()rnrn def loginMail(self):rn self.mccLog.mccWriteLog(u'开始登录邮箱')rn try:rn self.pp=poplib.POP3_SSL(self.pophost)rn self.pp.set_debuglevel(0)rn self.pp.user(self.username)rn self.pp.pass_(self.password)rn self.pp.list()rn print u'登录成功!'rn self.mccLog.mccWriteLog(u'登录邮箱成功。')rn except Exception,e:rn print u'登录失败!'rn self.mccLog.mccError(u'登录邮箱失败'+str(e))rn exit()rnrn def acceptMail(self):rn self.mccLog.mccWriteLog(u'开始抓取邮件')rn try:rn ret=self.pp.list()rn mailBody=self.pp.retr(len(ret[1]))rn self.mccLog.mccWriteLog(u'抓取邮件成功')rn return mailBodyrn except Exception,e:rn self.mccLog.mccError(u'抓取邮件失败'+str(e))rn return Nonernrn def analysisMail(self,mailBody):rn self.mccLog.mccWriteLog(u'开始抓取subject和发件人')rn try:rn subject=re.search(" 'Subject:(.*?)',",str(mailBody[1]).decode('utf-8'),re.S).group(1)rn sender=re.search(" 'X-Sender:(.*?)',",str(mailBody[1]).decode('utf-8'),re.S).group(1)rn command='subject':subject,'sender':senderrn self.mccLog.mccWriteLog(u'抓取subject和发件人成功')rn return commandrn except Exception,e:rn self.mccLog.mccError(u'抓取subject和发件人失败'+str(e))rn return Nonernrn def configSlaveMail(self):rn self.mccLog.mccWriteLog(u'开始配置发件箱')rn try:rn self.handle=smtplib.SMTP(self.smtphost,self.port)rn self.handle.login(self.username,self.password)rn self.mccLog.mccWriteLog(u'发件箱配置成功')rn except Exception,e:rn self.mccLog.mccError(u'发件箱配置失败'+str(e))rn exit()rnrn def sendMail(self,subject,receiver,body='Success'):rn msg=MIMEText(body,'plain','utf-8')rn msg['Subject']=subjectrn msg['from']=self.usernamern self.mccLog.mccWriteLog(u'开始发送邮件'+'to'+receiver)rn if receiver =='Slave':rn try:rn self.handle.sendmail(self.username,self.username,msg.as_string())rn self.mccLog.mccWriteLog(u'发送邮件成功')rn return Truern except Exception,e:rn self.mccLog.mccError(u'发送邮件失败'+str(e))rn return Falsern elif receiver =='Boss':rn try:rn self.handle.sendmail(self.username,self.bossMail,msg.as_string())rn self.mccLog.mccWriteLog(u'发送邮件成功')rn except Exception,e:rn self.mccLog.mccError(u'发送邮件失败'+str(e))rn return Falsernrnif __name__ == '__main__':rn mail=mailHelper()rn body=mail.acceptMail()rn print bodyrn print mail.analysisMail(body)rn mail.sendMail('test','Boss')rn[/code]rnrnmccLog.pyrn[code=python]rn#coding:utf-8rnimport loggingrnfrom datetime import datetimernrnclass mccLog(object):rn def __init__(self):rn logging.basicConfig(level=logging.DEBUG,rn format='%(asctime)s %(levelname)s %(message)s',rn datefmt='%Y-%m-%d %H:%M:%S',rn filename=datetime.now().strftime("%Y%m%d%H%M%S")+'.log',rn filemode='a')rnrn def mccWriteLog(self,logContent):rn logging.info(logContent)rnrn def mccError(self,errorContent):rn logging.error(errorContent)rn[/code]rnrn以下是程序运行截图:rn[img=https://img-bbs.csdn.net/upload/201603/06/1457257492_846848.png][/img]rnrn求助~急~
Python 写文件报错TypeError的解决办法
处理上传的文件:        f1 = request.FILES['pic']        fname = '%s/%s' % (settings.MEDIA_ROOT, f1.name)        with open(fname, 'w') as pic:            for c in f1.chunks():                pic.write(c)测试报错:...
用pip安装库时出现 TypeError: 'encoding' is an invalid keyword argument for this functio
[img=https://img-bbs.csdn.net/upload/201610/08/1475915427_613538.png][/img][img=https://img-bbs.csdn.net/upload/201610/08/1475915513_976705.png][/img]rn大家有没有遇到过这种错误呢?
Python使用类装饰器出现报错:TypeError: test2() missing 1 required positional argument: 'b'
```pythonrnrnclass Timer(object):rn def __init__(self, func):rn self.func = funcrnrn def __call__(self, *args, **kwargs):rn print("权限验证成功...")rn result = self.func(*args, **kwargs)rn print("新添加退出成功提示...")rn return resultrnrnrnclass Test(object):rnrn @Timerrn def test2(self, a, b): # 需要参数的rn c = a + brn print("test2两个数的求和结果是:", c)rnrnrnt = Test()rnt.test2(2, 3)rn```rnrn出现报错:TypeError: test2() missing 1 required positional argument: 'b'rnrn为什么会出现selef必须传参呢,如果在test2上面添加@staticmethod删除selef参数将不会出现报错,但是这不符合装饰器的用法了,应该怎么改才能使得Test类不该任何代码的情况下加@Timer就能直接使用呢
Delphi7报错 No argument for format '%'
代码如下,报错No argument for format '%'rnuses IdMultipartFormData;rnrnprocedure TForm1.Button2Click(Sender: TObject);rnvarrn Data: TIdMultipartFormDataStream;rnbeginrn Data := TIdMultipartFormDataStream.Create;rn Data.AddFormField('cz','产值2%');rnend;
python: TypeError: object__new__takes no parameter
错误RT,刚看完byte of python,想照着建一个通讯录,但是不知道为啥总是报错,求解。。。rnrn[code=Python][/code]rn#!/usr/bin/pythonrn# File name: first.pyrnrnclass person():rn '''represent any one in my world.'''rn def __int__(self, name, phone, address, email):rn self.name = namern self.phone = phonern self.address = addressrn self.email = emailrn print('(Initialized person: 0)'.format(self.name))rnrn def show(self):rn '''show details about this person.'''rn print('Name:"0" Phone: "1"'.format(self.name,self.phone),end="\n")rn print('Address:"0" Email:"1"'.format(self.address,self.email),end="\n")rnrnclass friend(person):rn '''represent any friend in my world.'''rn def __int__(self, name, phone, address, email, nickname):rn person.__int__(self,name,phone,address,email)rn self.nickname = nicknamern print('(Initialized friend: 0)'.format(self.name))rnrn def show(self):rn person.show(self)rn print('Nickname:"0"'.format(self.nickname))rnrnclass family(person):rn '''represent any family member in my world.'''rn def __int__(self, name, phone, address, email, relation):rn person.__int__(self,name,phone,address,email)rn self.relation = relationrn print ('(Initialized family member: 0)'.format(self.name))rnrn def show(self):rn person.show(self)rn print('Relationship:"0"'.format(self.relation))rnrnrnclass collegue(person):rn '''represent any collegue in my world.'''rn def __int__(self, name, phone, address, email, major):rn person.__int__(self,name,phone,address,email)rn self.major = majorrn print('(Initialized collegue: 0)'.format(self.name))rnrn def show(self):rn person.show(self)rn print('Major:"0"'.format(self.major))rnrnprint ()rnrnt =friend('zz',1377,'yz','cc@126.com','eg')rn
紧急求助,typeerror
[code=python]from django.db import modelsrnrn# Create your models here.rnrnrnclass Topic(models.Model):rn '''用户学习的主题'''rn text = models.CharField(max_length=200)rn date_added = models.DateTimeField(auto_now_add=True)rnrn def _str_(self):rn '''返回模型的字符串表示'''rn return self.textrnrnclass Entry(models.Model):rn '''学到的有关某个主题的具体知识'''rn topic = models.ForeignKey(Topic)rn text = models.TextField()rn date_added = models.DateTimeField(auto_now_add=True)rnrn class Meta:rn verbose_name_plural = 'entries'rnrn def _str_(self):[img=https://img-bbs.csdn.net/upload/201801/09/1515471717_758480.png][/img]rn '''返回模型的字符串表示'''rn return self.text[:50] + '...'rn[/code]rn[img=https://img-bbs.csdn.net/upload/201801/09/1515471742_810330.png][/img]rn这是为什么啊求大佬解答一下rn
Python初学者:TypeError
# -*- coding: utf-8 -*-nprint ("你好")nprint("what is your name \nTom")nnnumber_list=[1,2,3,4]nprint("number list="+str(number_list))nn# string_list=["abd","bbc","python"]nstring_list = ["abc", "bbc", "python"]nprint("string_list="+string_list)nTypeError: Can't convert 'list' object to str implicitly
mongoexport报错:unexpected indentifer
刚刚接触MongoDB,求大神指教啊~ rn导出数据,所有教材里都是这样格式写的:rn>mongoexport -d test -c person -o person.datrn但是我输入之后的结果一直是下面这样的:rnSyntaxError:Unexpected indentifierrncmd开关了好多次,还是这样。。。把横线改成 --db --collection --out 仍然是错的。。。rn真的不知道是不是我的数据库安装有问题,还是哪里没有配置好,求各路大神指教啊,先谢过啦~rn[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/50.gif][/img]
python中的TypeError错误解决办法
新手在学习python时候,会遇到很多的坑,下面来具体说说其中一个。 在使用python编写面向对象的程序时,新手可能遇到TypeError: this constructor takes no arguments这个错误。 例如下面的程序: class Ball: def _init_(self,color,size,direction):
Python中的rank()理解
rank 表示在这个数在原来的Series中排第几名,有相同的数,取其排名平均(默认)作为值。obj = pd.Series([7,-5,7,4,2,0,4]) obj.rank() 0 6.5 1 1.0 2 6.5 3 4.5 4 3.0 5 2.0 6 4.5 dtype: float64在obj中,4和4的排名是第4名和第五名,取平均得4.5。7和7
【报错求助】node 报错unexpected token 意外的标记~
代码语法是 es6的 rnnode安装了es6支持:npm install --save-dev babel-cli 、npm install --save-dev babel-preset-es2015、npm install --save-dev babel-preset-stage-0rn给大佬们看下代码 [img=https://img-bbs.csdn.net/upload/201809/27/1538013496_277003.jpg][/img]
extjs4.0 报错TypeError: container is null
之前好好的今天突然报了这个错误 extjs 4.0 报错TypeError: container is null 这是什么原因?
Delphi7报错 invalid use of keyword
[img=https://img-bbs.csdn.net/upload/201503/10/1425959862_524532.png][/img]rn[img=https://img-bbs.csdn.net/upload/201503/10/1425959936_201243.png][/img]rn-------------------------rnrnimplementationrnrn$R *.dfmrnrnprocedure TForm1.Button1Click(Sender: TObject);rn varrn idx:integer;rn ord1,ord2:string;rnbeginrn idx:= ListBox1.ItemIndex;rn if edit1.text='' thenrn ord1:='1' //按第一列排序rn elsern ord1:=edit1.Text; //取排序列rn if RadioGroup1.ItemIndex =0 thenrn ord2:='ASC' //升序rn elsern ord2:='DESC'; //降序rnrn Query1.Close;rn Query1.SQL.Clear;rn Query1.SQL.Add('Select * From'+ListBox1.Items[idx]);rn Query1.SQL.Add('Order by'+ord1+ ''+ord2);rn Query1.Open;rnend;rnrnend.rnrn==================rnDelphi7报错 invalid use of keywordrntoken: from stunedtrnOrderrnLine Number:1rn问题出在哪儿?rn
关于RANK OVER报错的问题
本人刚涉及到ORACLE开发,老实说一点都不懂就开始做,前几天写了个东西,里面包含了rnRANK() OVER(rnPARTITION BY。。。。。rn)“RANK”rn第1行的2个括号一直报错,特别妖的地方是,把这段SELECT语句拉出来单独编译的时候一点错误都没有,但是在整个PACKAGE里一起便宜的话就错了,郁闷的很rn希望有大虾照顾下我这个菜鸟,帮忙考虑下会是什么地方错了,先谢了rn
hibernate 报错:argument type mismatch
请教下我的配置错在哪儿?该如何改正:rnrnException in thread "main" org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of org.wangchao.association.Class.studentsrn at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:104)rn at org.hibernate.tuple.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:330)rn at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:188)rn at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3232)rn at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:253)rn at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)rn at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:502)rn at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:494)rn at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:134)rn at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:213)rn at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:157)rn at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:108)rn at org.hibernate.engine.Cascade.cascade(Cascade.java:248)rn at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:385)rn at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:242)rn at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)rn at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)rn at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)rn at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)rn at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)rn at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)rn at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)rn at org.wangchao.association.Test.main(Test.java:78)rnCaused by: java.lang.IllegalArgumentException: argument type mismatchrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:42)rn ... 30 morernrnrnrnrnrnrnrnrnrnrnrnrn
TypeError: get() missing 1 required positional argument: 'self'
from tkinter import *rnfrom random import randintrnimport randomrnclass displayzhifangtu:rn def __init__(self):rn rn window=Tk()rn window.title('diaplay zhifangtu')rn self.st=50rn self.w=30rn self.list1=[int(10*x) for x in range(1,21)]rn self.width=500rn self.height=400rn self.item=0.0rnrn self.canvas=Canvas(window,width=self.width,height=self.height,bg='white')rn self.canvas.pack()rnrn self.frame=Frame(window)rn self.frame.pack()rn self.number=IntVarrn self.enternumber=Entry(self.frame,textvariable=self.number)rn self.enternumber.pack(side=LEFT)rn self.stbutton=Button(self.frame,text='step',command=self.step)rn self.stbutton.pack(side=LEFT)rn self.resbutton=Button(self.frame,text='reset',command=self.reset)rn self.resbutton.pack(side=LEFT)rn rn self.sleeptime=100rn rn self.drawzft()rn window.mainloop()rn def step(self):rn self.item=self.number.get()rn for x in self.list1:rn if self.item==x:rn self.canvas.create_rectangle(self.st+self.w*x,self.height-self.list1[x],self.st+self.w*(x+1),self.height,fill='red',tags='zft')rnrn def reset(self):rn rn self.canvas.delete('string')rn self.canvas.delete('zft')rn self.drawzft()rn rn def drawzft(self):rn random.shuffle(self.list1)rn for x in range(20):rn self.canvas.create_text(self.st+self.w*x,self.height-self.list1[x]-5,text=self.list1[x]/10,tags='string')rn self.canvas.create_rectangle(self.st+self.w*x,self.height-self.list1[x],self.st+self.w*(x+1),self.height,tags='zft')rndisplayzhifangtu()
javax.xml.bind.UnmarshalException: unexpected element 求助
以下是错误日志中报的错误:rnrnjavax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.yale.edu/tp/cas", local:"serviceResponse"). Expected elements are rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:523)rn at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199)rn at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:194)rn at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:71)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:920)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:364)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:345)rn at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:117)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173)rn at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)rn at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)rn at com.safetys.framework.cas.client.util.HttpUtil.getMessageCode(HttpUtil.java:140)rn at com.safetys.framework.cas.client.util.HttpUtil.postObject(HttpUtil.java:88)rn at com.safetys.framework.cas.client.util.HttpUtil.post(HttpUtil.java:71)rn at com.safetys.framework.cas.client.validation.CasProxyValidator.validate(CasProxyValidator.java:39)rn at com.esse.projects.ajgis.business.manager.impl.UserMap.login4SSO(Unknown Source)rn at sun.reflect.GeneratedMethodAccessor4338.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)rn at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)rn at $Proxy6.login4SSO(Unknown Source)rn at com.esse.projects.ajgis.business.Operate.getLoginUser(Unknown Source)rn at org.apache.jsp.portal.common.login_jsp._jspService(login_jsp.java:73)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)rn at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)rn at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)rn at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)rn at org.apache.jsp.portal.index_jsp._jspService(index_jsp.java:68)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:73)rn at com.esse.projects.ajgis.struts2.StrutsPrepareAndExecuteFilterExt.doFilter(Unknown Source)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at com.esse.common.service.listener.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:66)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)rn at java.lang.Thread.run(Unknown Source)rnrnrn我想问下,uri中的"http://www.yale.edu/tp/cas"这个地址是怎么来的,我在程序中都搜索不到。
"DateWindow Error" "Expecting 2 retrieval argument but got 1"
我在做一个图书馆管理系统,这个是借书还书的模块rnrn我在一个普通窗口上面创建了两个 数据窗口控件 分别连接后 命名为 dw_bok,dw_brwrn rn通过对书号sle_bokid.text和借书证号sle_brwid.text 查询分别把数据输出到两个对应的窗口中(dw_bok,dw_brw)再对其进rnrn行借书与还书操作rnrn但是运行时出现了如题的错误提示("DateWindow Error" ——"Expecting 2 retrieval argument but got 1")rnrn在下无解,望各位大虾不吝相助!!!rnrnPB 初学者
angularjs Error: [ng:areq] Argument 'PhoneListCtrl' is not a function, got undef
以下代码返回错误rnError: [ng:areq] Argument 'PhoneListCtrl' is not a function, got undefinedrn请问大家是什么原因?rnrn[code=html]rnrn rn rn rn rn rn rn rn phone.namern phone.snippetrn rn rn rn[/code]
Python の TypeError 及解决方案(二)
在初学Python中遇到的Bug or 与预期不符的状况<built-in method istitle of str object at 0x000001A5DE5676C0>在学习string built-in function  e.g. string1='Upper'        print(string1.istitle)>>> <built-in ...
HQL查询语句报错 unexpected token
hibernate中我查询两张表中的数据,我这样写查询语句,但就是抱错 select t.name,t.type,s.name from Ren t inner join Type s on t.type=s.id 错误如下: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: on near line 1, column 64 [select t.name,t.type,s.name from liubi.Ren t inner join Type s on t.type=s.id]
JavaScript控制台报错:unexpected token (
新手,求大神不吝赐教rnrn[code=javascript]rnrnrn 增删节点rn rnrn rnrnrn rn rn 春rn 夏rn 秋rn 冬rn rnrn[/code]
checkstyle校验出错Got an exception - Unexpected character 0xfeff in identifier
将java源代码转换成utf-8后, checkstyle报出 error ,信息是Got an exception - Unexpected character 0xfeff in identifierrn搞不明白是咋回事, 因为文件头用UE等16进制编辑器看,明明是 FE BB BF
Python报错TypeError: 'float' object cannot be interpreted as an integer
在Python代码里调用了zeros函数,按理说里面的dtype参数本来就应该是float啊。。不知道为什么会一直报错,代码如下:rn[code=python]def _load_representation(self):rn '''rn load user and item latent features generate by MF for every meta-graphrn '''rn #if dt in ['yelp-200k', 'amazon-200k', 'amazon-50k', 'amazon-100k', 'amazon-10k', 'amazon-5k', 'cikm-yelp', 'yelp-50k', 'yelp-10k', 'yelp-5k', 'yelp-100k', 'douban']:rn fnum = self.N / 2rn ufilename = self.data_dir + 'uids.txt'rn bfilename = self.data_dir + 'bids.txt'rn uids = [int(l.strip()) for l in open(ufilename, 'r').readlines()]rn uid2reps = k:np.zeros(fnum, dtype=np.float64) for k in uidsrnrn bids = [int(l.strip()) for l in open(bfilename, 'r').readlines()]rn bid2reps = k:np.zeros(fnum, dtype=np.float64) for k in bidsrnrn ufiles, vfiles = self._generate_feature_files()rnrn feature_dir = self.data_dir + 'mf_features/path_count/'rn for find, filename in enumerate(ufiles):rn ufs = np.loadtxt(feature_dir + filename, dtype=np.float64)rn cur = find * self.Frn for uf in ufs:rn uid = int(uf[0])rn f = uf[1:]rn uid2reps[uid][cur:cur+self.F] = frnrn for find, filename in enumerate(vfiles):rn bfs = np.loadtxt(feature_dir + filename, dtype=np.float64)rn cur = find * self.Frn for bf in bfs:rn bid = int(bf[0])rn f = bf[1:]rn bid2reps[bid][cur:cur+self.F] = frn logging.info('load all representations, len(ufiles)=%s, len(vfiles)=%s, ufiles=%s, vfiles=%s', len(ufiles), len(vfiles), '|'.join(ufiles), '|'.join(vfiles))rn return uid2reps, bid2reps[/code]rn rn应该是里面这两句有问题:rn[code=python]uids = [int(l.strip()) for l in open(ufilename, 'r').readlines()]rnuid2reps = k:np.zeros(fnum, dtype=np.float64) for k in uids[/code]rnrn前面有导入numpy“import numpy as np”,求大神指点到底是哪里错了。。一直提示“TypeError: 'float' object cannot be interpreted as an integer”。。
django 出注提示:'sex' is an invalid keyword argument for this function
viewsrn[code=python]# -*- coding:utf-8 -*-rnfrom django.http import HttpResponseRedirect, HttpResponsernfrom django.template import RequestContextrnfrom django.shortcuts import render_to_response, get_object_or_404rnfrom django.contrib.auth.decorators import login_requiredrnfrom django.views.generic import ListView, DetailViewrnfrom django.contrib.auth.models import Userrnfrom django.core.paginator import Paginator, EmptyPage, PageNotAnIntegerrnfrom models import *rnfrom forms import *rnimport datetimernfrom django.db.models import Qrnfrom django.contrib import authrnfrom django.contrib.auth import authenticaternfrom django.core.urlresolvers import reversernrnITEMS_PER_PAGE = 15rnrnrnrn##注册函数rndef zbvip_reg(request):rn if request.method == 'POST':rn form = Reg_Form(request.POST, request.FILES)rn if form.is_valid():rn user = User.objects.create_user(rn username = form.cleaned_data['username'],rn password = form.cleaned_data['password1'],rn email = form.cleaned_data['email'],rn sex = form.cleaned_data['sex'],rn addr_zz = form.cleaned_data['addr_zz'],rn #tximg = form.cleaned_data['tximg'],rn ahjs = form.cleaned_data['ahjs'],rn rn )rn user.save()rn user = authenticate(username=form.cleaned_data['username'], password=form.cleaned_data['password1'])rn #user = authenticate(username=user.username, password=user.password)rn auth.login(request, user)rn return HttpResponseRedirect('/zbvip/reg/ok/')rn #return render_to_response('registration/register_success.html', 'user': request.user)rn else:rn return HttpResponse(u'注册用户时发生错误,请返回修改后重新注册!')rn else:rn form = Reg_Form()rn variables = RequestContext(request, 'form':form)rn return render_to_response('registration/register.html', variables)rnrn#会员用户注册成功会的函数rndef reg_ok(request):rn return render_to_response('registration/register_success.html', 'user':request.user)[/code]rnrnrnrnrnrnmodels[code=python]# -*- coding:utf-8 -*-rnfrom django.db import modelsrnfrom django.contrib import adminrnfrom django.contrib.auth.models import Userrnfrom django.contrib.auth.admin import UserAdminrnrnclass ProfileBase(type):rn def __new__(cls, name, bases, arrts):rn module = attrs.pop('__module__')rn parents = [b for b in bases if isinstance(b, ProfileBase)]rnrnrn if parents:rn fileds = []rn for obj_name, obj in attrs.items():rn if isinstance(obj, models.Field):fields.append(obj_name)rn User.add_to_class(obj_name, obj)rn UserAdmin.fieldsets = list(UserAdmin.fieldsets)rn UserAdmin.fieldsets.append((name, 'fields':fields))rn return super(ProfileBase, cls).__new__(cls, name, bases, attrs)rnrn rnclass ProfileUser(object):rn __metaclas__ = ProfileBasernrnrnclass MyProfileUser(ProfileUser):rn SEX_CHOICES = ((u'保密', u'保密'),(u'男', u'男'),(u'女', u'女'))rn sex = models.CharField(verbose_name=u'性别', choices=SEX_CHOICES, max_length=2)rn addr_zz = models.CharField(max_length='100', blank=True)rn ahjs = models.CharField(max_length='300', null=True, blank=True)[/code]rnrnhtmlrn[code=python]rnrnrn rn 无标题文档rnrnrnrn% if user.is_authenticated %rn你已经登陆了。点击这里查看你的注册信息。rn% else %rn rn% csrf_token %rn rn rn 用户名:rn form.username  ×[必填选项 - 字符长度要大于4] rn rn rn 密码:rn form.password1 ×[必填选项] rn rn rn 重复密码:rn form.password2 ×[必填选项]rn rn rn rn 你的性别:rn form.sex rn rnrn rn 电子邮箱:rn form.email *[必填选项] rn rn rn rn 居住地rn form.addr_zz -(选填)rn rn rn rn rn rn 情况介绍rn form.ahjs -(选填-建议公司或个体商户填写)rn rn rn rn rn rn rn rn rn rn提示:上面红色提示的选项必须填写,其它的可以看情况选填 rn rn rn % endif %rnrn[/code]rnrnrn执行的时候提示这样的错:rn[code=python]Environment:rnrnrnRequest Method: POSTrnRequest URL: http://127.0.0.1:8000/zbvip/reg/rnrnDjango Version: 1.5.1rnPython Version: 2.7.4rnInstalled Applications:rn('django.contrib.auth',rn 'django.contrib.contenttypes',rn 'django.contrib.sessions',rn 'django.contrib.sites',rn 'django.contrib.messages',rn 'django.contrib.staticfiles',rn 'django.contrib.admin',rn 'vipbbs')rnInstalled Middleware:rn('django.middleware.common.CommonMiddleware',rn 'django.contrib.sessions.middleware.SessionMiddleware',rn 'django.middleware.csrf.CsrfViewMiddleware',rn 'django.contrib.auth.middleware.AuthenticationMiddleware',rn 'django.contrib.messages.middleware.MessageMiddleware')rnrnrnTraceback:rnFile "E:\Python27\lib\site-packages\django\core\handlers\base.py" in get_responsern 115. response = callback(request, *callback_args, **callback_kwargs)rnFile "E:\python\zbvip\vipbbs\views.py" in zbvip_regrn 33. ahjs = form.cleaned_data['ahjs'],rnFile "E:\Python27\lib\site-packages\django\contrib\auth\models.py" in create_userrn 183. last_login=now, date_joined=now, **extra_fields)rnFile "E:\Python27\lib\site-packages\django\db\models\base.py" in __init__rn 415. raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])rnrnException Type: TypeError at /zbvip/reg/rnException Value: 'sex' is an invalid keyword argument for this function[/code]
TypeError: translate() takes exactly one argument (2 given)
如题,python 2.7 升级为python3.5.12后下面此段代码出错rn[code=python] def HaveChineseChar(contents):rn identify = str.maketrans('', '')rn delEStr = string.punctuation + ' ' + string.digitsrn contents = contents.translate(identify, delEStr)rn if re.findall('[\x80-\xff].', contents):rn return Truern else :rn return False[/code]rn错误提示rn contents = contents.translate(identify, delEStr)rnTypeError: translate() takes exactly one argument (2 given)rn请问该如何解决,谢谢。
keras中的基本问题
一、更换国内镜像安装: 一般安装为pip install tensorflow 更换之后为:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow 若要指定版本则 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==1.0 二、版...
Python の TypeError 及解决方案(一)
1、TypeError : argument of type 'int' is not iterable   类型'int'的参数不可迭代Python (3.7.14)中键入如下代码:为了判断1是否在list中。1)采用成员操作符 in ,返回Bool 类型的值。(True  or  False )。2)多重List嵌套,需手动引入下一层。类似C中二维数组or数组。但是出现如下提示,导致无法显示结...
python中的用来排名的rank()
Series和DataFrame通过rank将平均排名分配到每个组来打破平级关系。 1. rank()就表示这个数在原来的排名,如果遇到两个数相等,就取这两个数排名的平均值 obj = pd.Series([5, 9, 2, 10, 9, 2, 0]) print(obj.rank()) 结果: 0 4.0 1 5.5 2 2.5 3 7.0 4 5.5 ...
Python の TypeError 及解决方案(三)
Something about Format Character (关于格式符の那些事~)键入如图所示代码 , 第一行成功打印出结果,第二行出现TypeError :解析:type(g) 即 g的类型为 string (即图中提到的str) , 不管用list() 、tuple()、max()、min() 等函数,function 都是先创建一个对应类型,根据原parameter (string ...
rank()
rank()函数返回结果集分区内指定字段的值的排名,指定字段的值的排名是相关行之前的排名加一。 RANK() OVER([]) partition_by_clause 将from子句生成的结果集划分为应用到RANK函数的分区。 Order_by_clause确定将RANK值应用到分区中的行时所使用的顺序。 以下用一个成绩表作示例, table 架构 s_score(s_class(
Rank
Problem DescriptionnJackson wants to know his rank in the class. The professor has posted a list of student numbers and marks. Compute Jackson’s rank in class; that is, if he has the top mark(or is tied for the top mark) his rank is 1; if he has the second best mark(or is tied) his rank is 2, and so on.n nnInputnThe input consist of several test cases. Each case begins with the student number of Jackson, an integer between 10000000 and 99999999. Following the student number are several lines, each containing a student number between 10000000 and 99999999 and a mark between 0 and 100. A line with a student number and mark of 0 terminates each test case. There are no more than 1000 students in the class, and each has a unique student number.n nnOutputnFor each test case, output a line giving Jackson’s rank in the class.n nnSample Inputn20070101n20070102 100n20070101 33n20070103 22n20070106 33n0 0n nnSample Outputn2n
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制