通过一本书学习python,tkinter.END在一段代码中使用,不解释
import tkinter
def count(text, out_data):
""" Update out_data with the total number of As, Ts, Cs, and Gs found in text."""
data = text.get('0.0', **tkinter.END**)
counts = {}
for char in 'ATCG':
counts[char] = data.count(char)
out_data.set('Num As: {0} Num Ts: {1} Num Cs: {2} Num Gs: {3}'.format(
counts['A'], counts['T'], counts['C'], counts['G']))
...
Run Code Online (Sandbox Code Playgroud)
我在网上查过,我只遇到过它的例子,从来没有提到它的功能。我help(tkinter)在 shell 中尝试过END = 'end',结果不是很有用。如果需要更多代码,请告诉我。不想发布整个代码,让您无缘无故地阅读更多内容。
Entry()tkinter和函数有什么区别Text()?
在网上找不到任何东西,所以弄清楚后,想将其发布在网上供其他人使用。
名为“实用编程:第二版”的书有冲突的代码。这是我的代码的开始:
import sqlite3
con = sqlite3.connect('stackoverflow.db')
cur = conn.cursor()
Run Code Online (Sandbox Code Playgroud)
要提交,我会使用con.commit(),cur.commit()还是有不同的时间来使用每个?摘自书中:
con.commit():
cur.commit():
我正在学习python,我无法围绕书中的一段代码:
def find_value(List, value):
for i in range(len(List)):
if List[i] == value:
return i
return -1
Run Code Online (Sandbox Code Playgroud)
我已经尝试运行代码,如果值在其中则返回索引,如果不是则返回-1,但我不明白是因为'return -1'在for循环之外和if语句,每次执行代码时都不应该运行吗?或者只返回一次,第一次被调用?
我想在继续之前确保理解这个概念.提前致谢
我的图像为display: block;、text-align: center;、 ,width: 33%;但仍然没有居中或表现得像 33%。我也尝试过width: 33vw(33%视口宽度),仍然没有运气。
我尝试创建一个100%的容器,然后创建一个图像所在的div,仍然没有解决它。我有一种强烈的感觉,这很愚蠢,但我已经看代码太久了,我找不到它。我只是希望徽标的大小发生变化,以便手机上的用户可以看到完整的徽标,而不必向右滚动。
a {
text-decoration: none;
color: black;
}
nav {
position: sticky;
position: -webkit-sticky;
top: 0;
}
.nav {
position: sticky;
left: 0;
background-color: rgba(255,255,255,.8);
border-radius: 0px;
border: none;
width: 100%;
padding: 10px 0;
flex-direction: row;
display: flex;
align-items: center;
justify-content: space-evenly;
}
.item {
color: black;
font-weight: bold;
text-transform: capitalize;
width: 25%;
text-align: center;
}
.submenu {
display: none;
flex-wrap: wrap;
align-items: center;
align-text: …Run Code Online (Sandbox Code Playgroud)