gpt4 book ai didi

python - 将长数字文字分成多行

转载 作者:太空宇宙 更新时间:2023-11-04 06:59:44 24 4
gpt4 key购买 nike

将长 string 文字分成多行不是问题,例如。 g.

long_string = ("This is a very very long string literal for writing it as one-line "
"literal. More appropriate is using more lines so that the code"
"will be more readable.")

但是长整数 字面量呢? G。

long_number = 12312323456782556897455666645555554787825401568014564565678978201245667185

有没有类似的可能?

最佳答案

你可以这样做:

long_numer = int("1231232345678255689745"
"5666645555554787825401"
"5680145645656789782012"
"45667185")

只要这不在您的热代码路径中,额外的步骤就不会导致问题。

关于python - 将长数字文字分成多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45270961/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com