增加两个没有模块的类的属性?(Increment attributes of two class without modules?)
如何在不导入其他模块的情况下创建一个可以像这样运行的类?
>>date(2014,2,2) + delta(month=3) >>(2014, 5, 2) >> >>date(2014, 2, 2) + delta(day=3) >>(2014, 2, 5) >>date(2014, 2, 2) + delta(year=1, month=2) >>(2015, 4, 2)
这是我的代码:
# class delta(date): # year = date(year) # def __init__(self,y,m,d): # self.y = y + year # self.m = m # self.d = d # def __call__(self): # return self.y, self.m, self.d class date(object): def __init__(self,year,month,day): self.year = year self.month = month self.day = day def __call__(self): return self.year, self.month, self.day
How to make a class which could operate like this without importing other modules?
>>date(2014,2,2) + delta(month=3) >>(2014, 5, 2) >> >>date(2014, 2, 2) + delta(day=3) >>(2014, 2, 5) >>date(2014, 2, 2) + delta(year=1, month=2) >>(2015, 4, 2)
This is my code:
# class delta(date): # year = date(year) # def __init__(self,y,m,d): # self.y = y + year # self.m = m # self.d = d # def __call__(self): # return self.y, self.m, self.d class date(object): def __init__(self,year,month,day): self.year = year self.month = month self.day = day def __call__(self): return self.year, self.month, self.day
原文:https://stackoverflow.com/questions/39373998
更新时间:2023-02-18 21:02
最满意答案
您只能使用
<a href>
的<strong>
标记。我会改变以下行
$title = '<a href="' . $title_pieces[0] . '" title="' . $title_pieces[1] . '">' . $title_pieces[1] . '</a>';
至
$title = '<a href="' . $title_pieces[0] . '" title="' . $title_pieces[1] . '"><strong>' . $title_pieces[1] . '</strong></a>';
You could only use the
<strong>
tag in the<a href>
.I would change the following line
$title = '<a href="' . $title_pieces[0] . '" title="' . $title_pieces[1] . '">' . $title_pieces[1] . '</a>';
to
$title = '<a href="' . $title_pieces[0] . '" title="' . $title_pieces[1] . '"><strong>' . $title_pieces[1] . '</strong></a>';
相关问答
更多-
如果您在底部“了解更多”链接,罪魁祸首似乎是 vertical-align: middle; 在你的style.css中 html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd ...
-
Wordpress baseurl(Wordpress baseurl)[2022-04-10]
通常使用wordpress所有使用创建的文件都将在模板目录中,因此使用其中一个内置函数,如get_template_directory() include_once(get_template_directory() . '/inc/somefile.php'); http://codex.wordpress.org/Function_Reference/get_template_directory 这有许多相关的功能: http://codex.wordpress.org/Determining_Plug ... -
wordpress函数和PHP strtoupper(应该很快)(wordpress function and PHP strtoupper (should be quick))[2022-08-31]
尝试在CSS菜单中添加: text-transform:uppercase; Try to add in the menu CSS this: text-transform:uppercase; -
由于您使用的是WordPress,因此执行此操作的方法是在functions.php使用wp_localize_script发送JavaScript变量: add_action('wp_enqueue_scripts', 'my_frontend_data'); function my_frontend_data() { global $current_user; wp_localize_script('data', 'Data', array( 'userMeta' => get_user ...
-
WordPress php重定向(WordPress php redirect)[2023-06-22]
你应该将你的代码片段包装在一个挂钩到template_redirect的函数中,或者在get_header调用之前将它放在page.php (或任何其他页面模板)的最顶层。 You should wrap your snippet in a function hooked to template_redirect, OR put it at the very top of page.php (or any other page template), before the get_header call. -
Wordpress分页(Wordpress Pagination)[2022-06-13]
如果不查看请求生成的WP_Query,很难说。 但我确实看到可能导致问题的东西,query_posts改变了主查询,这可能会搞乱分页。 尝试使用get_posts而不是query_posts,因此主循环不受影响。 可在此处找到更详细的说明 It's hard to say without looking at the WP_Query generated by the requests. But I do see something that might be causing problems, query ... -
Wordpress PHP帮助(Wordpress PHP assistance)[2022-03-27]
代码无效,因为输入字段的名称已更改。 您需要使用新名称,或者需要向input元素添加自定义ID或类。 jQuery(document).ready(function($) { var hiddenRef = $("#hiddenRef").val(); $("input[name*='addon-707-poster-0[reference]']").val(hiddenRef); if (hiddenRef != "") { $( ... -
Wordpress + jScrollPane(Wordpress + jScrollPane)[2023-11-26]
1: 2: http : //www.radiospeck.it/barchitects/wp-content/themes/spacing/ ... -
你不能在ajax文件中运行javascript函数..而是在ajaxfile中运行所需的php代码 然后是您可以执行警报功能的响应 submitHandler: ...