这是我的查询
SELECT P.product_name
,ID.price
,ID.sub_total
FROM invoice_details ID
LEFT JOIN products P ON P.product_no = ID.product_no
WHERE ID.invoice_no = 1;
ID.Price和ID.sub_total数据类型为十进制(10,2),但当我运行该查询时,ID.price和ID.sub_total保持对齐。我需要输出右对齐,并作为十进制,我试着铸造,但它没有工作。请帮助我找出正确的查询格式为十进制右对齐输出。-谢谢
我想知道如何在视觉块中右对齐,而不更改之前的文本和块。
在此之前,我一直使用此代码:
:<C-U>'<,'>s/\%V\(.\{-}\)\(\s\{-}\)\%(\%V\@!\|$\)/\2\1/
然而,我注意到,当视觉块之后只有空格时,它就不起作用了。(为了使上面的代码工作,在可视块之后必须有文本)
在可视块中,无论在块之后写什么,都没有办法将文本右对齐吗?
示例:
text before +align text text after
text before align text text after
text before a
我有下面的ipython笔记本代码(标记):
#### example table
|Name|Description|
|--|-------------------------------|
|Mary |She is a nice girl.|
|Jackie |He is a very naughty boy.|
输出如下:
我如何才能:
左对齐单元格的表,默认情况下它是中心。
右对齐第二个col文本。
面对Python的这个问题:
a = "text"
print('{0:>10}'.format(a))
# output: text
b = "\x1b[33mtext\x1b[0m"
print('{0:>10}'.format(b))
# output: text
正如您所看到的,一旦给文本添加了着色标记,右对齐就不起作用了。第二个"text“应该缩进为第一个,但它没有缩进。
如何在一列中打印这些函数。
item = stock.stock_list(location_name)
for x in sorted(item):
"""Stock list of given location"""
print (x)
for y in sorted(item):
"""Stock price of give location and stock list"""
print ("{0:.2f}".format(sto