Comments (4)
主要是,日期有三个数用以辨认,如果单纯地写成 {zh_obj:>xx}
这样的形式,其实反而会出误解,比如如果写{zh_obj:>6}
是大于六月的日期还是大于六号的日期?我们还是需要保证代码可读性的吧……
from zhdate.
新年快乐;感谢回应 @EillesWan
我的意思是, {str:>16} 是向右对齐16字符的意思,不是大于还是小于16号
我发现这个可能是python对于unicode的特色;如果我把 str 返回的字串再拿去format() 一次,结果就可以向右对齐。
可能就是这个nested 结构看了复杂,但是可以用就是了。感谢。
python3 -c 'from zhdate import ZhDate; d1=ZhDate(2024,1,1); s1=("{}".format(d1)); print("{:>16}".format(s1))'
农历2024年1月1日
# or
python3 -c 'from zhdate import ZhDate; d1=ZhDate(2024,1,1); print("{:>16}".format("{}".format(d1)))'
农历2024年1月1日
from zhdate.
使用者自己可以藉由巢状结构,即, "{:>16}.format( "{}".format(zh_obj)) ,来避开 {:>16} 向右对齐失败的问题。
感谢
from zhdate.
啊,非常抱歉,我确实理解错了你的意思(完了暴露自己没水平了😅),这确实是一个蛮有用的提议,可以试试加上
from zhdate.
Related Issues (6)
- 农历中『二十』的 计数单位换成 『廿』会不会好点。 HOT 1
- 无法转换2024年2月9日 HOT 5
- 部分日期带有时间部分时农历转换会出现异常 HOT 2
- f字符串只支持python 3.6以上 HOT 3
- 建议 chinese 返回一个对象, 以便用于数据处理 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zhdate.