- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
enter code here
我正在阅读《Python 速成类(class)》,我列了一个简单的邀请参加晚宴的人员名单。我删除、添加和替换了列表上的姓名,问题是:当我尝试打印更新/新的人员列表时,我收到此错误,我尝试了我能想到的一切:
AttributeError: 'list' object has no attribute 'title'
我更改了变量名称“Dinner”,仔细检查了变量的每次使用。我无法弄清楚错误是什么。
Dinner = ["Emiel", "Louie", "Ben", "Jim", "Ant"]
Invite_Emiel = "Hello" + " " + Dinner[0] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Emiel)
Invite_Louie = "Hello" + " " + Dinner[1] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Louie)
Invite_Ben = "Hello" + " " + Dinner[2] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Ben)
Invite_Jim = "Hello" + " " + Dinner[3] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Jim)
Invite_Ant = "Hello" + " " + Dinner[4] + " " + "Would you like to go to dinner with me and some others?\n"
print(Invite_Ant)
cant_go = Dinner[1] + " " + "Can't go to the party, he called, his daughter died.\n"
print(cant_go)
Dinner_remove = Dinner.remove('Louie')
Dinner_add = Dinner.insert(1, 'Chris')
New_People = "Here's the list for the people coming to dinner:" + " " + Dinner.title()
print(Dinner)
<小时/>
完全错误:
Traceback (most recent call last):
File "C:\Users\Tyler\Desktop\PCC TS\pcc.py", line 28, in <module>
New_People = "Here's the list for the people coming to dinner:" + " " + Dinner.title()
AttributeError: 'list' object has no attribute 'title'
就像我说的,我对问题所在或如何解决它没有任何想法。
最佳答案
实际上列表没有 .title() 函数,您可以执行以下操作:
New_People = "Here's the list for the people coming to dinner:" + " " + str(Dinner)
print(New_People)
关于python - 属性错误: 'list' object has no attribute 'title' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55555016/
有什么方法可以覆盖无法直接编辑的页面标题,只能在页眉中添加 Javascript? 我不能直接编辑的行是: Title of the page 我能想到的解决这个问题的唯一方法是在我可以通过我的门户后
这是我的基础文件 {% load static %} {% include "feed/header.html" %} {% block content%} {% endblock %} {% inc
请说明 之间有什么区别标记和 标签。 Page title 如果两者都使用,哪个最优先? 我观察到一些网站同时具有 和 tags 和 两者相同,这是预期的,请确认? 如果我们不使用 标签标题,我
我有一个带有唯一title的表_primary,并且我有一个需要设置引用title的表_secondary > 对于 _primary 表。 最佳答案 尝试这个解决方案并让我知道它对您有用。 ALTE
我正在尝试学习使用 PDO 而不是 MySQLi 进行数据库访问,但我在从数据库中选择数据时遇到了问题。我想使用: $STH = $DBH->query('SELECT * FROM ratings
我了解 title 和 alt 属性的用途,但我只是不了解它们的最佳用途,或者我是否可以使用相同的 title /alt 不止一次。 例如,以一个关于狗的网站为例: 根据我的理解,所有 img 标签都
我分配了一个带有标题 (initWithTitle) 的 UITabBarItem 并将其连接到 UINavigationController。 我发现,如果导航 Controller 的 Root
我有标签栏和导航栏。在导航栏中我有表格 View 。问题是,当我在 IB 中将标题设置为选项卡栏,然后在 TableView 中设置标题时,选项卡栏标题将更改为 TableView 中的标题,并且我在
在我的 JSP 页面中,我使用 显示页面标题,有时可以,但有时页面显示无法cpmplie代码 。所以我将代码更改为 ${TITLE} ,也可以。 有什么不同和${TITLE}在jsp中? 这是我的页
我目前正在向 Jade 和 node.js 介绍自己 由于我想避免冗余,我想到将域名附加到当前标题,例如Blog | example.com 我的 Jade 模板得到了 Blog通过 Node.js
//Sorting userDefined object from ArrayList<>... import java.io.*; import java.util.*; class Song
我的网站有这两个元标记,它们目前具有相同的值: 第二个是 facebook 连接所需的格式。 这是否意味着第一个是多余的并且可以删除? 最佳答案 最好同时存在这两个标签。该标签告诉搜索引擎有
我现在对 ASP.NET MVC 的 Razor ViewEngine 感到困惑。 大多数人会说: View.Title 与相同 ViewData["Title"] 运行应用程序后我得到了这个 Com
UIViewController 的 title 属性的用途是什么,不能用 navigationItem.title 设置标题吗? 两者似乎都有效,我只是想知道为什么会有这种看似重复的功能。 最佳答案
我仍在学习如何将 API 数据与 react 和 nextjs 一起使用。但是,为什么我的函数只在我编写 {props.props.title} 而不是我期望的 {props.title} 时起作用?
我正在尝试编写一个从URL提取的正则表达式,但是问题是“。”与我们已经知道的不匹配换行符。如何编写正则表达式以匹配和提取pageTitle(。*?),但换行符可能介于 我在用grails。 最佳答案
我仍在学习如何将 API 数据与 react 和 nextjs 一起使用。但是,为什么我的函数只在我编写 {props.props.title} 而不是我期望的 {props.title} 时起作用?
我正在 github 上创建一个库,所以我为此使用了一个 Markdown 文件,其结构如下: # My main title ## My first section ... ## My second
我在某些地方看到,为了从 props 中获取 title 的值,我们使用 {`${props.title} `} 而在其他一些地方,我们使用它 {props.title} 有什么区别? 最佳答案 第一
我想使用 IMG 标签的 TITLE 属性,为图像创建标题: HTML CSS img[title]:after{content:attr(title);} 但是无论是在 IE、Firefox 还是
我是一名优秀的程序员,十分优秀!