[Lang] Support very basic python string.format() now#2552
Merged
ljcc0930 merged 7 commits intotaichi-dev:masterfrom Jul 20, 2021
Merged
[Lang] Support very basic python string.format() now#2552ljcc0930 merged 7 commits intotaichi-dev:masterfrom
ljcc0930 merged 7 commits intotaichi-dev:masterfrom
Conversation
Contributor
Author
|
/format |
Contributor
Author
|
We support basic string format in print now. For example, code below: import taichi as ti
ti.init()
ops = ti.field(ti.float32, shape=(1, ))
yes = ti.field(ti.int32, shape=(1, ))
@ti.kernel
def test():
ops[0] = 3.14
yes[0] = 3
print('Two numbers:', ' {} and {} '.format(ops[0], yes[0]), 'and a list: ', ['q', 'w', 'e', 'r'], sep='|')
print('round{}square{}what?{}'.format(ops[0], 123, ' wellwellwell'))
test()Would print the result: |
Contributor
Author
|
/format |
1 similar comment
Contributor
|
/format |
ljcc0930
reviewed
Jul 20, 2021
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue = #2396