python中typeerror是什么意思_TypeError:在Python中
我有一个问题,函数返回一个数字。当我试图组装一个包含该号码的URL时,我遇到了失败。在
具体来说,我得到的错误是TypeError: cannot concatenate 'str' and 'NoneType' objects
不知道从这里到哪里去。在
以下是相关代码:# Get the raw ID number of the current configuration
configurationID = generate_configurationID()
# Update config name at in Cloud
updateConfigLog = open(logBase+'change_config_name_log.xml', 'w')
# Redirect stdout to file
sys.stdout = updateConfigLog
rest.rest(('put', baseURL+'configurations/'+configurationID+'?name=this_is_a_test_', user, token))
sys.stdout = sys.__stdout__
如果我手动将以下内容输入休息。休息()
^{pr2}$
我试过str(configurationID),它返回了一个数字,但我再也无法获得URL的其余部分。。。在
有什么想法?帮忙吗?在
好吧。。。为了显示我的baseURL和configurationID,我做了些什么。在print 'baseURL: '+baseURL
print 'configurationID: '+configurationID
这是我得到的it-tone:trunk USER$ ./skynet.py fresh
baseURL: https://myurl.com/
369596
Traceback (most recent call last):
File "./skynet.py", line 173, in
main()
File "./skynet.py", line 30, in main
fresh()
File "./skynet.py", line 162, in fresh
updateConfiguration()
File "./skynet.py", line 78, in updateConfiguration
print 'configurationID: '+configurationID
TypeError: cannot concatenate 'str' and 'NoneType' objects
it-tone:trunk USER$
我感兴趣的是369596是配置ID,但和以前一样,它似乎会破坏它周围的所有调用。在
正如kindall在下面指出的,我的generate_configurationID并不是返回值,而是打印它。在# from generate_configurationID
def generate_configurationID():
dom = parse(logBase+'provision_template_log.xml')
name = dom.getElementsByTagName('id')
p = name[0].firstChild.nodeValue
print p
return p
python中typeerror是什么意思_TypeError:在Python中相关推荐
- python字符串索引必须是整数_TypeError:在Python中,字符串索引必须是整数
我想从currency converter API得到的Json响应中获取key和value,得到一个错误:"of string index must be integers".下 ...
- Tensorflow:TypeError: pred must not be a Python bool
这个问题常见且不小心就会遇到,记录下O(∩_∩)O哈! frr@frr:~/Documents/code/pointnet/models$ python pointnet_SE.py ('input_ ...
- 解决python中TypeError: not enough arguments for format string
解决python中TypeError: not enough arguments for format string for i in range(1,10): for j in range(1,i ...
- python中的静态方法如何调用_关于Python中如何使用静态、类、抽象方法的权威指南(译)...
对于Python中静态.类.抽象方法的使用,我是一直很迷糊的.最近看到一篇技术文章对这方面解释的很好,在此翻译一下,加深印象,也为有需要的同学提供一个方便. Python中方法是如何工作的: 方法即函 ...
- eval在python中是什么意思_如何在Python中使用eval ?
Python中的 eval是什么? 在Python中,我们有许多内置方法,这些方法对于使Python成为所有人的便捷语言至关重要,而eval是其中一种.eval函数的语法如下: eval(expres ...
- python中的str方法和repr方法_Python中 的 __str__ 方法和 __repr__ 方法的区别有哪些
Python中 的 __str__ 方法和 __repr__ 方法的区别有哪些 发布时间:2020-11-05 17:11:48 来源:亿速云 阅读:95 作者:Leah 本篇文章给大家分享的是有关P ...
- python获取命令行参数_【整理】Python中如何获得并处理命令行参数
运行Python脚本时,时常需要从命令行中传递一些参数到Python程序中,但是如何获得相应的传递进来的参数,以及如何解析这些参数,是很多人,包括最开始的我,所遇到的问题. 下面,就对此总结一下: 先 ...
- TypeError: 'str' object is not callable (Python)
2019独角兽企业重金招聘Python工程师标准>>> 在Docker中运行Zeppelin,使用%python解释器. 莫名其妙出现: TypeError: 'str' objec ...
- python中如何调用函数_如何调用python中的内置函数?(实例解析)
对于第一次接触到python这门编程语言的朋友来说,刚刚开始学习python编程的时候对于python函数调用这一方面的了解比较少,在这篇文章之中我们就来了解一下python怎么调用函数. Pytho ...
最新文章
- 手工管理和计算机管理,ERP系统管理与传统的手工管理之间的区别
- linux java maven项目_Java maven项目在window下运行正常,部署到Linux环境中启动报错,是由什么引起的?...
- c#winform演练 ktv项目 实现播放完了一曲自动播放下一曲的功能
- mysql数据库主从出现1236错误
- 6.3 API : XGBoost
- 2019华为软件精英挑战赛 赛后总结
- java servlet 视频_Servlet开发的理论提升视频教程 - JavaWeb - Java - 私塾在线 - 只做精品视频课程服务...
- 趋势科技防毒墙—控管中心
- Spring Boot设置匹配指定后缀*.action *.do的路径
- python计算无穷级数求和_[探求无穷级数求和的几种常用方法]无穷级数求和常用公式...
- 制图软件CAD基础知识科普手册(一)
- linux filp open,Linux Kernel 'do_filp_open()'本地拒绝服务漏洞
- 浅谈go语言交叉编译
- 计算机知识动画小学,电脑动画
- 垃圾邮件过滤优化方法
- aes在tomcat解密中文乱码,在控制台解密中文不是乱码
- MySQL将多条数据合并成一条
- python抓取每期双色球中奖号码,用于分析
- Exchange绝妙使用-日历、邮件、通讯录双向同步
- 还在担心无代码是否威胁程序员饭碗?