[英]How can I get a string(Mix of digit and char) up to last digit using regex in python?
[英]Can I get Last Digit of an Integer in Python
我正在尝试查找我的 Integer 的最后一位数字。 但无法找到它。
Note -
我在我的工作盘中使用.split()。
# cooking my dish here
x = str(input())
letters = ""
words = x.split()
for word in words:
letters += word[0]
a = int(word(0) + word[-1])
print(a)
我想用这个错误来结束所有的事情。
21
Traceback (most recent call last):
File "E:\testererterset.py", line 9, in <module>
a = int(word(0) + word[-1])
TypeError: 'str' object is not callable
>>>
我需要认真的帮助。 如果您希望我非常了解,您也可以在下面分享您的代码。 到那时为止!
word(0)
类型错误:'str' object 不可调用
word[0]
应该管用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.